src/Entity/IctusPharmacie.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Validator\Constraints as CustomAssert;
  6. use Doctrine\Common\Collections\Collection;
  7. use App\Repository\IctusPharmacieRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  11. /**
  12.  * @ORM\Entity(repositoryClass=IctusPharmacieRepository::class)
  13.  * @UniqueEntity(fields = {"pagename"},message ="Page existe déjà existe")
  14.  */
  15. class IctusPharmacie
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $uuid;
  27.     /**
  28.      * @ORM\Column(type="string", length=255)
  29.      */
  30.     private $designation;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      */
  34.     private $logo;
  35.     /**
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      */
  38.     private $numeroordre;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      */
  42.     private $nif;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     private $stat;
  47.     /**
  48.      * @ORM\Column(type="boolean", nullable=true)
  49.      */
  50.     private $isValid false;
  51.     /**
  52.      * @ORM\Column(type="float", nullable=true)
  53.      */
  54.     private $logitude;
  55.     /**
  56.      * @ORM\Column(type="float", nullable=true)
  57.      */
  58.     private $latitude;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=Stockpharmacie::class, mappedBy="ictuspharmacie")
  61.      */
  62.     private $stockpharmacies;
  63.     /**
  64.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="ictusPharmacie")
  65.      */
  66.     private $users;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      */
  70.     private $adresse;
  71.     /**
  72.      * @ORM\ManyToOne(targetEntity=Quartier::class, inversedBy="ictusPharmacies")
  73.      */
  74.     private $quartier;
  75.     /**
  76.      * @ORM\OneToMany(targetEntity=LivraisonPharmacie::class, mappedBy="ictus_pharmacie")
  77.      */
  78.     private $livraisonPharmacies;
  79.     /**
  80.      * @ORM\OneToMany(targetEntity=IctusPaiementPharmacie::class, mappedBy="pharmacie")
  81.      */
  82.     private $ictusPaiementPharmacies;
  83.     /**
  84.      * @ORM\OneToMany(targetEntity=IctusHoraire::class, mappedBy="ictus_pharmacie")
  85.      */
  86.     private $ictusHoraires;
  87.     /**
  88.      * @ORM\OneToMany(targetEntity=IctusCommande::class, mappedBy="pharmacie")
  89.      */
  90.     private $ictusCommandes;
  91.     private $distanceParRapportPatient;
  92.     /**
  93.      * @ORM\Column(type="string", length=255, nullable=true)
  94.      */
  95.     private $photocouverture;
  96.     /**
  97.      * @ORM\Column(type="string", length=255, nullable=true)
  98.      */
  99.     private $pagename;
  100.     /**
  101.      * @ORM\OneToMany(targetEntity=IctoRemboursement::class, mappedBy="demandeur", orphanRemoval=true)
  102.      */
  103.     private $ictoRemboursements;
  104.     /**
  105.      * @ORM\OneToMany(targetEntity=IctoParampov::class, mappedBy="pharmacie", orphanRemoval=true)
  106.      */
  107.     private $ictoParampovs;
  108.     /**
  109.      * @ORM\OneToMany(targetEntity=IctoMouvement::class, mappedBy="pharmacie", orphanRemoval=true)
  110.      */
  111.     private $ictoMouvements;
  112.     /**
  113.      * @ORM\OneToMany(targetEntity=AchatIctocoin::class, mappedBy="pharmacie", orphanRemoval=true)
  114.      */
  115.     private $achatIctocoins;
  116.     /**
  117.      * @ORM\OneToMany(targetEntity=IctusPanierSpecial::class, mappedBy="pharmacie", orphanRemoval=true)
  118.      */
  119.     private $ictusPanierSpecials;
  120.     /**
  121.      * @ORM\Column(type="boolean", nullable=true)
  122.      */
  123.     private $isCommandeSpecial;
  124.     /**
  125.      * @ORM\OneToMany(targetEntity=CommandeSpecial::class, mappedBy="pharmacie")
  126.      */
  127.     private $commandeSpecials;
  128.     /**
  129.      * @ORM\Column(type="boolean", nullable=true)
  130.      */
  131.     private $isValideAutomatique;
  132.     /**
  133.      * @ORM\Column(type="float", nullable=true)
  134.      */
  135.     private $pourcentageCommandeSpecial;
  136.     /**
  137.      * @ORM\OneToMany(targetEntity=FacturePatient::class, mappedBy="pharmacie", orphanRemoval=true)
  138.      */
  139.     private $facturePatients;
  140.     /**
  141.      * @ORM\Column(type="string", length=255, nullable=true)
  142.      */
  143.     private $rcs;
  144.     /**
  145.      * @ORM\OneToMany(targetEntity=ProductBlackList::class, mappedBy="pharmacie", orphanRemoval=true)
  146.      */
  147.     private $productBlackLists;
  148.     /**
  149.      * @ORM\OneToMany(targetEntity=HistoriqueMaj::class, mappedBy="pharmacie", orphanRemoval=true)
  150.      */
  151.     private $historiqueMajs;
  152.     /**
  153.      * @ORM\ManyToMany(targetEntity=Tierpayant::class, mappedBy="pharmacie")
  154.      */
  155.     private $tierpayants;
  156.     /**
  157.      * @ORM\OneToMany(targetEntity=Parcours::class, mappedBy="pharmacie")
  158.      */
  159.     private $parcours;
  160.     /**
  161.      * @ORM\Column(type="string", length=255, nullable=true)
  162.      */
  163.     private $mailResponsable;
  164.     /**
  165.      * @ORM\OneToMany(targetEntity=FacturePharmacie::class, mappedBy="pharmacie", orphanRemoval=true)
  166.      */
  167.     private $facturePharmacies;
  168.     /**
  169.      * @ORM\OneToMany(targetEntity=Rate::class, mappedBy="pharmacie")
  170.      */
  171.     private $rates;
  172.     /**
  173.      * @ORM\OneToMany(targetEntity=IctusReclamation::class, mappedBy="pharmacie")
  174.      */
  175.     private $ictusReclamations;
  176.     /**
  177.      * @ORM\Column(type="string", length=255, nullable=true)
  178.      */
  179.     private $realDesignation;
  180.     /**
  181.      * @ORM\OneToMany(targetEntity=RemiseUserPharmacie::class, mappedBy="pharmacie")
  182.      */
  183.     private $remiseUserPharmacies;
  184.     /**
  185.      * @ORM\ManyToMany(targetEntity=Assurance::class, mappedBy="pharmacie")
  186.      */
  187.     private $assurances;
  188.     /**
  189.      * @ORM\OneToMany(targetEntity=CertCertificat::class, mappedBy="pharmacie", orphanRemoval=true)
  190.      */
  191.     private $certCertificats;
  192.     public function __construct()
  193.     {
  194.         $this->stockpharmacies = new ArrayCollection();
  195.         $this->users           = new ArrayCollection();
  196.         $this->uuid            uniqid((new \DateTime())->format('YmdHis'));
  197.         $this->livraisonPharmacies = new ArrayCollection();
  198.         $this->ictusPaiementPharmacies = new ArrayCollection();
  199.         $this->ictusHoraires = new ArrayCollection();
  200.         $this->ictusCommandes = new ArrayCollection();
  201.         $this->ictoRemboursements = new ArrayCollection();
  202.         $this->ictoParampovs = new ArrayCollection();
  203.         $this->ictoMouvements = new ArrayCollection();
  204.         $this->achatIctocoins = new ArrayCollection();
  205.         $this->ictusPanierSpecials = new ArrayCollection();
  206.         $this->commandeSpecials = new ArrayCollection();
  207.         $this->facturePatients = new ArrayCollection();
  208.         $this->productBlackLists = new ArrayCollection();
  209.         $this->historiqueMajs = new ArrayCollection();
  210.         $this->tierpayants = new ArrayCollection();
  211.         $this->parcours = new ArrayCollection();
  212.         $this->facturePharmacies = new ArrayCollection();
  213.         $this->rates = new ArrayCollection();
  214.         $this->ictusReclamations = new ArrayCollection();
  215.         $this->remiseUserPharmacies = new ArrayCollection();
  216.         $this->assurances = new ArrayCollection();
  217.         $this->certCertificats = new ArrayCollection();
  218.     }
  219.     public function getId(): ?int
  220.     {
  221.         return $this->id;
  222.     }
  223.     public function setId($id)
  224.     {
  225.         $this->id $id;
  226.         return $this;
  227.     }
  228.     public function getUuid(): ?string
  229.     {
  230.         return $this->uuid;
  231.     }
  232.     public function setUuid(?string $uuid): self
  233.     {
  234.         $this->uuid $uuid;
  235.         return $this;
  236.     }
  237.     public function getDesignation(): ?string
  238.     {
  239.         return $this->designation;
  240.     }
  241.     public function setDesignation(string $designation): self
  242.     {
  243.         $this->designation $designation;
  244.         return $this;
  245.     }
  246.     public function getLogo(): ?string
  247.     {
  248.         return $this->logo;
  249.     }
  250.     public function setLogo(?string $logo): self
  251.     {
  252.         $this->logo $logo;
  253.         return $this;
  254.     }
  255.     public function getNumeroordre(): ?string
  256.     {
  257.         return $this->numeroordre;
  258.     }
  259.     public function setNumeroordre(?string $numeroordre): self
  260.     {
  261.         $this->numeroordre $numeroordre;
  262.         return $this;
  263.     }
  264.     public function getNif(): ?string
  265.     {
  266.         return $this->nif;
  267.     }
  268.     public function setNif(?string $nif): self
  269.     {
  270.         $this->nif $nif;
  271.         return $this;
  272.     }
  273.     public function getStat(): ?string
  274.     {
  275.         return $this->stat;
  276.     }
  277.     public function setStat(?string $stat): self
  278.     {
  279.         $this->stat $stat;
  280.         return $this;
  281.     }
  282.     public function isIsValid(): ?bool
  283.     {
  284.         return $this->isValid;
  285.     }
  286.     public function setIsValid(?bool $isValid): self
  287.     {
  288.         $this->isValid $isValid;
  289.         return $this;
  290.     }
  291.     public function getLogitude(): ?float
  292.     {
  293.         return $this->logitude;
  294.     }
  295.     public function setLogitude(?float $logitude): self
  296.     {
  297.         $this->logitude $logitude;
  298.         return $this;
  299.     }
  300.     public function getLatitude(): ?float
  301.     {
  302.         return $this->latitude;
  303.     }
  304.     public function setLatitude(?float $latitude): self
  305.     {
  306.         $this->latitude $latitude;
  307.         return $this;
  308.     }
  309.     /**
  310.      * @return Collection<int, Stockpharmacie>
  311.      */
  312.     public function getStockpharmacies(): Collection
  313.     {
  314.         return $this->stockpharmacies;
  315.     }
  316.     public function addStockpharmacy(Stockpharmacie $stockpharmacy): self
  317.     {
  318.         if (!$this->stockpharmacies->contains($stockpharmacy)) {
  319.             $this->stockpharmacies[] = $stockpharmacy;
  320.             $stockpharmacy->setIctuspharmacie($this);
  321.         }
  322.         return $this;
  323.     }
  324.     public function removeStockpharmacy(Stockpharmacie $stockpharmacy): self
  325.     {
  326.         if ($this->stockpharmacies->removeElement($stockpharmacy)) {
  327.             // set the owning side to null (unless already changed)
  328.             if ($stockpharmacy->getIctuspharmacie() === $this) {
  329.                 $stockpharmacy->setIctuspharmacie(null);
  330.             }
  331.         }
  332.         return $this;
  333.     }
  334.     /**
  335.      * @return Collection<int, User>
  336.      */
  337.     public function getUsers(): Collection
  338.     {
  339.         return $this->users;
  340.     }
  341.     public function addUser(User $user): self
  342.     {
  343.         if (!$this->users->contains($user)) {
  344.             $this->users[] = $user;
  345.             $user->setIctusPharmacie($this);
  346.         }
  347.         return $this;
  348.     }
  349.     public function removeUser(User $user): self
  350.     {
  351.         if ($this->users->removeElement($user)) {
  352.             // set the owning side to null (unless already changed)
  353.             if ($user->getIctusPharmacie() === $this) {
  354.                 $user->setIctusPharmacie(null);
  355.             }
  356.         }
  357.         return $this;
  358.     }
  359.     public function getAdresse(): ?string
  360.     {
  361.         return $this->adresse;
  362.     }
  363.     public function setAdresse(?string $adresse): self
  364.     {
  365.         $this->adresse $adresse;
  366.         return $this;
  367.     }
  368.     public function getQuartier(): ?Quartier
  369.     {
  370.         return $this->quartier;
  371.     }
  372.     public function setQuartier(?Quartier $quartier): self
  373.     {
  374.         $this->quartier $quartier;
  375.         return $this;
  376.     }
  377.     /**
  378.      * @return Collection<int, LivraisonPharmacie>
  379.      */
  380.     public function getLivraisonPharmacies(): Collection
  381.     {
  382.         return $this->livraisonPharmacies;
  383.     }
  384.     public function addLivraisonPharmacy(LivraisonPharmacie $livraisonPharmacy): self
  385.     {
  386.         if (!$this->livraisonPharmacies->contains($livraisonPharmacy)) {
  387.             $this->livraisonPharmacies[] = $livraisonPharmacy;
  388.             $livraisonPharmacy->setIctusPharmacie($this);
  389.         }
  390.         return $this;
  391.     }
  392.     public function removeLivraisonPharmacy(LivraisonPharmacie $livraisonPharmacy): self
  393.     {
  394.         if ($this->livraisonPharmacies->removeElement($livraisonPharmacy)) {
  395.             // set the owning side to null (unless already changed)
  396.             if ($livraisonPharmacy->getIctusPharmacie() === $this) {
  397.                 $livraisonPharmacy->setIctusPharmacie(null);
  398.             }
  399.         }
  400.         return $this;
  401.     }
  402.     /**
  403.      * @return Collection<int, IctusPaiementPharmacie>
  404.      */
  405.     public function getIctusPaiementPharmacies(): Collection
  406.     {
  407.         return $this->ictusPaiementPharmacies;
  408.     }
  409.     public function addIctusPaiementPharmacy(IctusPaiementPharmacie $ictusPaiementPharmacy): self
  410.     {
  411.         if (!$this->ictusPaiementPharmacies->contains($ictusPaiementPharmacy)) {
  412.             $this->ictusPaiementPharmacies[] = $ictusPaiementPharmacy;
  413.             $ictusPaiementPharmacy->setPharmacie($this);
  414.         }
  415.         return $this;
  416.     }
  417.     public function removeIctusPaiementPharmacy(IctusPaiementPharmacie $ictusPaiementPharmacy): self
  418.     {
  419.         if ($this->ictusPaiementPharmacies->removeElement($ictusPaiementPharmacy)) {
  420.             // set the owning side to null (unless already changed)
  421.             if ($ictusPaiementPharmacy->getPharmacie() === $this) {
  422.                 $ictusPaiementPharmacy->setPharmacie(null);
  423.             }
  424.         }
  425.         return $this;
  426.     }
  427.     /**
  428.      * @return Collection<int, IctusHoraire>
  429.      */
  430.     public function getIctusHoraires(): Collection
  431.     {
  432.         return $this->ictusHoraires;
  433.     }
  434.     public function addIctusHoraire(IctusHoraire $ictusHoraire): self
  435.     {
  436.         if (!$this->ictusHoraires->contains($ictusHoraire)) {
  437.             $this->ictusHoraires[] = $ictusHoraire;
  438.             $ictusHoraire->setIctusPharmacie($this);
  439.         }
  440.         return $this;
  441.     }
  442.     public function removeIctusHoraire(IctusHoraire $ictusHoraire): self
  443.     {
  444.         if ($this->ictusHoraires->removeElement($ictusHoraire)) {
  445.             // set the owning side to null (unless already changed)
  446.             if ($ictusHoraire->getIctusPharmacie() === $this) {
  447.                 $ictusHoraire->setIctusPharmacie(null);
  448.             }
  449.         }
  450.         return $this;
  451.     }
  452.     /**
  453.      * @return Collection<int, IctusCommande>
  454.      */
  455.     public function getIctusCommandes(): Collection
  456.     {
  457.         return $this->ictusCommandes;
  458.     }
  459.     public function addIctusCommande(IctusCommande $ictusCommande): self
  460.     {
  461.         if (!$this->ictusCommandes->contains($ictusCommande)) {
  462.             $this->ictusCommandes[] = $ictusCommande;
  463.             $ictusCommande->setPharmacie($this);
  464.         }
  465.         return $this;
  466.     }
  467.     public function removeIctusCommande(IctusCommande $ictusCommande): self
  468.     {
  469.         if ($this->ictusCommandes->removeElement($ictusCommande)) {
  470.             // set the owning side to null (unless already changed)
  471.             if ($ictusCommande->getPharmacie() === $this) {
  472.                 $ictusCommande->setPharmacie(null);
  473.             }
  474.         }
  475.         return $this;
  476.     }
  477.     /**
  478.      * Get the value of distanceParRapportPatient
  479.      */
  480.     public function getDistanceParRapportPatient()
  481.     {
  482.         return $this->distanceParRapportPatient;
  483.     }
  484.     /**
  485.      * Set the value of distanceParRapportPatient
  486.      *
  487.      * @return  self
  488.      */
  489.     public function setDistanceParRapportPatient($distanceParRapportPatient)
  490.     {
  491.         $this->distanceParRapportPatient $distanceParRapportPatient;
  492.         return $this;
  493.     }
  494.     public function getPhotocouverture(): ?string
  495.     {
  496.         return $this->photocouverture;
  497.     }
  498.     public function setPhotocouverture(?string $photocouverture): self
  499.     {
  500.         $this->photocouverture $photocouverture;
  501.         return $this;
  502.     }
  503.     public function getPagename(): ?string
  504.     {
  505.         return $this->pagename;
  506.     }
  507.     public function setPagename(?string $pagename): self
  508.     {
  509.         $this->pagename $pagename;
  510.         return $this;
  511.     }
  512.     /**
  513.      * @return Collection<int, IctoRemboursement>
  514.      */
  515.     public function getIctoRemboursements(): Collection
  516.     {
  517.         return $this->ictoRemboursements;
  518.     }
  519.     public function addIctoRemboursement(IctoRemboursement $ictoRemboursement): self
  520.     {
  521.         if (!$this->ictoRemboursements->contains($ictoRemboursement)) {
  522.             $this->ictoRemboursements[] = $ictoRemboursement;
  523.             $ictoRemboursement->setDemandeur($this);
  524.         }
  525.         return $this;
  526.     }
  527.     public function removeIctoRemboursement(IctoRemboursement $ictoRemboursement): self
  528.     {
  529.         if ($this->ictoRemboursements->removeElement($ictoRemboursement)) {
  530.             // set the owning side to null (unless already changed)
  531.             if ($ictoRemboursement->getDemandeur() === $this) {
  532.                 $ictoRemboursement->setDemandeur(null);
  533.             }
  534.         }
  535.         return $this;
  536.     }
  537.     /**
  538.      * @return Collection<int, IctoParampov>
  539.      */
  540.     public function getIctoParampovs(): Collection
  541.     {
  542.         return $this->ictoParampovs;
  543.     }
  544.     public function addIctoParampov(IctoParampov $ictoParampov): self
  545.     {
  546.         if (!$this->ictoParampovs->contains($ictoParampov)) {
  547.             $this->ictoParampovs[] = $ictoParampov;
  548.             $ictoParampov->setPharmacie($this);
  549.         }
  550.         return $this;
  551.     }
  552.     public function removeIctoParampov(IctoParampov $ictoParampov): self
  553.     {
  554.         if ($this->ictoParampovs->removeElement($ictoParampov)) {
  555.             // set the owning side to null (unless already changed)
  556.             if ($ictoParampov->getPharmacie() === $this) {
  557.                 $ictoParampov->setPharmacie(null);
  558.             }
  559.         }
  560.         return $this;
  561.     }
  562.     /**
  563.      * @return Collection<int, IctoMouvement>
  564.      */
  565.     public function getIctoMouvements(): Collection
  566.     {
  567.         return $this->ictoMouvements;
  568.     }
  569.     public function addIctoMouvement(IctoMouvement $ictoMouvement): self
  570.     {
  571.         if (!$this->ictoMouvements->contains($ictoMouvement)) {
  572.             $this->ictoMouvements[] = $ictoMouvement;
  573.             $ictoMouvement->setPharmacie($this);
  574.         }
  575.         return $this;
  576.     }
  577.     public function removeIctoMouvement(IctoMouvement $ictoMouvement): self
  578.     {
  579.         if ($this->ictoMouvements->removeElement($ictoMouvement)) {
  580.             // set the owning side to null (unless already changed)
  581.             if ($ictoMouvement->getPharmacie() === $this) {
  582.                 $ictoMouvement->setPharmacie(null);
  583.             }
  584.         }
  585.         return $this;
  586.     }
  587.     /**
  588.      * @return Collection<int, AchatIctocoin>
  589.      */
  590.     public function getAchatIctocoins(): Collection
  591.     {
  592.         return $this->achatIctocoins;
  593.     }
  594.     public function addAchatIctocoin(AchatIctocoin $achatIctocoin): self
  595.     {
  596.         if (!$this->achatIctocoins->contains($achatIctocoin)) {
  597.             $this->achatIctocoins[] = $achatIctocoin;
  598.             $achatIctocoin->setPharmacie($this);
  599.         }
  600.         return $this;
  601.     }
  602.     public function removeAchatIctocoin(AchatIctocoin $achatIctocoin): self
  603.     {
  604.         if ($this->achatIctocoins->removeElement($achatIctocoin)) {
  605.             // set the owning side to null (unless already changed)
  606.             if ($achatIctocoin->getPharmacie() === $this) {
  607.                 $achatIctocoin->setPharmacie(null);
  608.             }
  609.         }
  610.         return $this;
  611.     }
  612.     /**
  613.      * @return Collection<int, IctusPanierSpecial>
  614.      */
  615.     public function getIctusPanierSpecials(): Collection
  616.     {
  617.         return $this->ictusPanierSpecials;
  618.     }
  619.     public function addIctusPanierSpecial(IctusPanierSpecial $ictusPanierSpecial): self
  620.     {
  621.         if (!$this->ictusPanierSpecials->contains($ictusPanierSpecial)) {
  622.             $this->ictusPanierSpecials[] = $ictusPanierSpecial;
  623.             $ictusPanierSpecial->setPharmacie($this);
  624.         }
  625.         return $this;
  626.     }
  627.     public function removeIctusPanierSpecial(IctusPanierSpecial $ictusPanierSpecial): self
  628.     {
  629.         if ($this->ictusPanierSpecials->removeElement($ictusPanierSpecial)) {
  630.             // set the owning side to null (unless already changed)
  631.             if ($ictusPanierSpecial->getPharmacie() === $this) {
  632.                 $ictusPanierSpecial->setPharmacie(null);
  633.             }
  634.         }
  635.         return $this;
  636.     }
  637.     public function isIsCommandeSpecial(): ?bool
  638.     {
  639.         return $this->isCommandeSpecial;
  640.     }
  641.     public function setIsCommandeSpecial(?bool $isCommandeSpecial): self
  642.     {
  643.         $this->isCommandeSpecial $isCommandeSpecial;
  644.         return $this;
  645.     }
  646.     /**
  647.      * @return Collection<int, CommandeSpecial>
  648.      */
  649.     public function getCommandeSpecials(): Collection
  650.     {
  651.         return $this->commandeSpecials;
  652.     }
  653.     public function addCommandeSpecial(CommandeSpecial $commandeSpecial): self
  654.     {
  655.         if (!$this->commandeSpecials->contains($commandeSpecial)) {
  656.             $this->commandeSpecials[] = $commandeSpecial;
  657.             $commandeSpecial->setPharmacie($this);
  658.         }
  659.         return $this;
  660.     }
  661.     public function removeCommandeSpecial(CommandeSpecial $commandeSpecial): self
  662.     {
  663.         if ($this->commandeSpecials->removeElement($commandeSpecial)) {
  664.             // set the owning side to null (unless already changed)
  665.             if ($commandeSpecial->getPharmacie() === $this) {
  666.                 $commandeSpecial->setPharmacie(null);
  667.             }
  668.         }
  669.         return $this;
  670.     }
  671.     public function isIsValideAutomatique(): ?bool
  672.     {
  673.         return $this->isValideAutomatique;
  674.     }
  675.     public function setIsValideAutomatique(?bool $isValideAutomatique): self
  676.     {
  677.         $this->isValideAutomatique $isValideAutomatique;
  678.         return $this;
  679.     }
  680.     public function getPourcentageCommandeSpecial(): ?float
  681.     {
  682.         return $this->pourcentageCommandeSpecial;
  683.     }
  684.     public function setPourcentageCommandeSpecial(?float $pourcentageCommandeSpecial): self
  685.     {
  686.         $this->pourcentageCommandeSpecial $pourcentageCommandeSpecial;
  687.         return $this;
  688.     }
  689.     /**
  690.      * @return Collection<int, FacturePatient>
  691.      */
  692.     public function getFacturePatients(): Collection
  693.     {
  694.         return $this->facturePatients;
  695.     }
  696.     public function addFacturePatient(FacturePatient $facturePatient): self
  697.     {
  698.         if (!$this->facturePatients->contains($facturePatient)) {
  699.             $this->facturePatients[] = $facturePatient;
  700.             $facturePatient->setPharmacie($this);
  701.         }
  702.         return $this;
  703.     }
  704.     public function removeFacturePatient(FacturePatient $facturePatient): self
  705.     {
  706.         if ($this->facturePatients->removeElement($facturePatient)) {
  707.             // set the owning side to null (unless already changed)
  708.             if ($facturePatient->getPharmacie() === $this) {
  709.                 $facturePatient->setPharmacie(null);
  710.             }
  711.         }
  712.         return $this;
  713.     }
  714.     public function getRcs(): ?string
  715.     {
  716.         return $this->rcs;
  717.     }
  718.     public function setRcs(?string $rcs): self
  719.     {
  720.         $this->rcs $rcs;
  721.         return $this;
  722.     }
  723.     /**
  724.      * @return Collection<int, ProductBlackList>
  725.      */
  726.     public function getProductBlackLists(): Collection
  727.     {
  728.         return $this->productBlackLists;
  729.     }
  730.     public function addProductBlackList(ProductBlackList $productBlackList): self
  731.     {
  732.         if (!$this->productBlackLists->contains($productBlackList)) {
  733.             $this->productBlackLists[] = $productBlackList;
  734.             $productBlackList->setPharmacie($this);
  735.         }
  736.         return $this;
  737.     }
  738.     public function removeProductBlackList(ProductBlackList $productBlackList): self
  739.     {
  740.         if ($this->productBlackLists->removeElement($productBlackList)) {
  741.             // set the owning side to null (unless already changed)
  742.             if ($productBlackList->getPharmacie() === $this) {
  743.                 $productBlackList->setPharmacie(null);
  744.             }
  745.         }
  746.         return $this;
  747.     }
  748.     /**
  749.      * @return Collection<int, HistoriqueMaj>
  750.      */
  751.     public function getHistoriqueMajs(): Collection
  752.     {
  753.         return $this->historiqueMajs;
  754.     }
  755.     public function addHistoriqueMaj(HistoriqueMaj $historiqueMaj): self
  756.     {
  757.         if (!$this->historiqueMajs->contains($historiqueMaj)) {
  758.             $this->historiqueMajs[] = $historiqueMaj;
  759.             $historiqueMaj->setPharmacie($this);
  760.         }
  761.         return $this;
  762.     }
  763.     public function removeHistoriqueMaj(HistoriqueMaj $historiqueMaj): self
  764.     {
  765.         if ($this->historiqueMajs->removeElement($historiqueMaj)) {
  766.             // set the owning side to null (unless already changed)
  767.             if ($historiqueMaj->getPharmacie() === $this) {
  768.                 $historiqueMaj->setPharmacie(null);
  769.             }
  770.         }
  771.         return $this;
  772.     }
  773.     /**
  774.      * @return Collection<int, Tierpayant>
  775.      */
  776.     public function getTierpayants(): Collection
  777.     {
  778.         return $this->tierpayants;
  779.     }
  780.     public function addTierpayant(Tierpayant $tierpayant): self
  781.     {
  782.         if (!$this->tierpayants->contains($tierpayant)) {
  783.             $this->tierpayants[] = $tierpayant;
  784.             $tierpayant->addPharmacie($this);
  785.         }
  786.         return $this;
  787.     }
  788.     public function removeTierpayant(Tierpayant $tierpayant): self
  789.     {
  790.         if ($this->tierpayants->removeElement($tierpayant)) {
  791.             $tierpayant->removePharmacie($this);
  792.         }
  793.         return $this;
  794.     }
  795.     public function getMailResponsable(): ?string
  796.     {
  797.         return $this->mailResponsable;
  798.     }
  799.     public function setMailResponsable(?string $mailResponsable): self
  800.     {
  801.         $this->mailResponsable $mailResponsable;
  802.         return $this;
  803.     }
  804.     /**
  805.      * @return Collection<int, FacturePharmacie>
  806.      */
  807.     public function getFacturePharmacies(): Collection
  808.     {
  809.         return $this->facturePharmacies;
  810.     }
  811.     public function addFacturePharmacy(FacturePharmacie $facturePharmacy): self
  812.     {
  813.         if (!$this->facturePharmacies->contains($facturePharmacy)) {
  814.             $this->facturePharmacies[] = $facturePharmacy;
  815.             $facturePharmacy->setPharmacie($this);
  816.         }
  817.         return $this;
  818.     }
  819.     public function removeFacturePharmacy(FacturePharmacie $facturePharmacy): self
  820.     {
  821.         if ($this->facturePharmacies->removeElement($facturePharmacy)) {
  822.             // set the owning side to null (unless already changed)
  823.             if ($facturePharmacy->getPharmacie() === $this) {
  824.                 $facturePharmacy->setPharmacie(null);
  825.             }
  826.         }
  827.         return $this;
  828.     }
  829.     /**
  830.      * @return Collection<int, Rate>
  831.      */
  832.     public function getRates(): Collection
  833.     {
  834.         return $this->rates;
  835.     }
  836.     public function addRate(Rate $rate): self
  837.     {
  838.         if (!$this->rates->contains($rate)) {
  839.             $this->rates[] = $rate;
  840.             $rate->setPharmacie($this);
  841.         }
  842.         return $this;
  843.     }
  844.     public function removeRate(Rate $rate): self
  845.     {
  846.         if ($this->rates->removeElement($rate)) {
  847.             // set the owning side to null (unless already changed)
  848.             if ($rate->getPharmacie() === $this) {
  849.                 $rate->setPharmacie(null);
  850.             }
  851.         }
  852.         return $this;
  853.     }
  854.     /**
  855.      * @return Collection<int, IctusReclamation>
  856.      */
  857.     public function getIctusReclamations(): Collection
  858.     {
  859.         return $this->ictusReclamations;
  860.     }
  861.     public function addIctusReclamation(IctusReclamation $ictusReclamation): self
  862.     {
  863.         if (!$this->ictusReclamations->contains($ictusReclamation)) {
  864.             $this->ictusReclamations[] = $ictusReclamation;
  865.             $ictusReclamation->setPharmacie($this);
  866.         }
  867.         return $this;
  868.     }
  869.     public function removeIctusReclamation(IctusReclamation $ictusReclamation): self
  870.     {
  871.         if ($this->ictusReclamations->removeElement($ictusReclamation)) {
  872.             // set the owning side to null (unless already changed)
  873.             if ($ictusReclamation->getPharmacie() === $this) {
  874.                 $ictusReclamation->setPharmacie(null);
  875.             }
  876.         }
  877.         return $this;
  878.     }
  879.     public function getRealDesignation(): ?string
  880.     {
  881.         return $this->realDesignation;
  882.     }
  883.     public function setRealDesignation(?string $realDesignation): self
  884.     {
  885.         $this->realDesignation $realDesignation;
  886.         return $this;
  887.     }
  888.     /**
  889.      * @return Collection<int, RemiseUserPharmacie>
  890.      */
  891.     public function getRemiseUserPharmacies(): Collection
  892.     {
  893.         return $this->remiseUserPharmacies;
  894.     }
  895.     public function addRemiseUserPharmacy(RemiseUserPharmacie $remiseUserPharmacy): self
  896.     {
  897.         if (!$this->remiseUserPharmacies->contains($remiseUserPharmacy)) {
  898.             $this->remiseUserPharmacies[] = $remiseUserPharmacy;
  899.             $remiseUserPharmacy->setPharmacie($this);
  900.         }
  901.         return $this;
  902.     }
  903.     public function removeRemiseUserPharmacy(RemiseUserPharmacie $remiseUserPharmacy): self
  904.     {
  905.         if ($this->remiseUserPharmacies->removeElement($remiseUserPharmacy)) {
  906.             // set the owning side to null (unless already changed)
  907.             if ($remiseUserPharmacy->getPharmacie() === $this) {
  908.                 $remiseUserPharmacy->setPharmacie(null);
  909.             }
  910.         }
  911.         return $this;
  912.     }
  913.     /**
  914.      * @param float $userLatitude
  915.      * @param float $userLongitude
  916.      */
  917.     public function getDistance(float $userLatitudefloat $userLongitude): ?float
  918.     {
  919.         $rayonDeLaTerre 6371071.03;
  920.         if ($this->latitude === null || $this->logitude === null) {
  921.             return null;
  922.         }
  923.         $lat1 deg2rad($userLatitude);
  924.         $lon1 deg2rad($userLongitude);
  925.         $lat2 deg2rad($this->latitude);
  926.         $lon2 deg2rad($this->logitude);
  927.         $deltaLat $lat2 $lat1;
  928.         $deltaLon $lon2 $lon1;
  929.         $a sin($deltaLat 2) ** cos($lat1) * cos($lat2) * sin($deltaLon 2) ** 2;
  930.         $c asin(sqrt($a));
  931.         return $rayonDeLaTerre $c;
  932.     }
  933.     public function checkHorraire(): ?array
  934.     {
  935.         $dateSemaine = ['Monday' => 1'Tuesday' => 2'Wednesday' => 3'Thursday' => 4'Friday' => 5'Saturday' => 6'Sunday' => 7];
  936.         $result['classHoraire'] = "";
  937.         $result['textHoraire'] = "";
  938.         $result['descHoraire'] = "";
  939.         $dateTimeNow = new DateTime();
  940.         $dateTimeNow->modify('+2 hours');
  941.         if (count($this->getIctusHoraires()) > 0) {
  942.             $jour $dateSemaine[date("l"strtotime($dateTimeNow->format('Y-m-d')))];
  943.             $time $dateTimeNow->format('H:i:s');
  944.             $horaireNow $this->verifHoraireByTime($jour$time);
  945.             if ($horaireNow) {
  946.                 $heureDebut = new \DateTime($time);
  947.                 $heureFin = new \DateTime($horaireNow->getFin());
  948.                 $diff $heureDebut->diff($heureFin);
  949.                 $result['classHoraire'] = "bg-success text-white";
  950.                 $result['textHoraire'] = 'Ouverte';
  951.                 $result['descHoraire'] = 'sera fermée dans ' $diff->format('%Hh %Imn');
  952.             } else {
  953.                 $result['classHoraire'] = "bg-danger text-white";
  954.                 $result['textHoraire'] = 'Fermée';
  955.                 $horaireOtherOwnDay $this->getOtherHoraireOwnDay($jour$time);
  956.                 if ($horaireOtherOwnDay) {
  957.                     $heureDebut = new \DateTime($time);
  958.                     $heureFin = new \DateTime($horaireOtherOwnDay->getDebut());
  959.                     $diff $heureDebut->diff($heureFin);
  960.                     $result['descHoraire'] = 'sera ouverte dans ' $diff->format('%Hh %Imn');
  961.                 } else {
  962.                     $horaireOtherDay $this->getOtherHoraireNextDay($jour);
  963.                     if ($horaireOtherDay) {
  964.                         $diffDay = (int)$horaireOtherDay[0]->getJour() - $jour;
  965.                         $dateDebut = new \DateTime($dateTimeNow->format('Y-m-d H:i:s'));
  966.                         $dateFin = new \DateTime(date('Y-m-d ' $horaireOtherDay[0]->getDebut(), strtotime(' + ' $diffDay ' days')));
  967.                         $diff $dateDebut->diff($dateFin);
  968.                         $delais "";
  969.                         if ((int)$diff->format('%d') == 0) {
  970.                             $delais $diff->format('%Hh %Imn');
  971.                         } else {
  972.                             $delais $diff->format('%dj');
  973.                         }
  974.                         $result['descHoraire'] = 'sera ouverte dans ' $delais;
  975.                     } else {
  976.                         $horaireDebusSemaine $this->getFirstHoraire($jour);
  977.                         if ($horaireDebusSemaine) {
  978.                             $diffDay = (int)$horaireDebusSemaine->getJour() + ($jour);
  979.                             $dateDebut = new \DateTime($dateTimeNow->format('Y-m-d H:i:s'));
  980.                             $dateFin = new \DateTime(date('Y-m-d ' $horaireDebusSemaine->getDebut(), strtotime(' + ' $diffDay ' days')));
  981.                             $diff $dateDebut->diff($dateFin);
  982.                             $delais "";
  983.                             if ((int)$diff->format('%d') == 0) {
  984.                                 $delais $diff->format('%Hh %Imn');
  985.                             } else {
  986.                                 $delais $diff->format('%dj');
  987.                             }
  988.                             $result['descHoraire'] = 'sera ouverte dans ' $delais;
  989.                         }
  990.                     }
  991.                 }
  992.             }
  993.         } else {
  994.             $result null;
  995.         }
  996.         return $result;
  997.     }
  998.     private function verifHoraireByTime($jour$time): ?IctusHoraire
  999.     {
  1000.         foreach ($this->getIctusHoraires() as $horaire) {
  1001.             if (
  1002.                 $horaire->getJour() === $jour &&
  1003.                 $horaire->getDebut() <= $time &&
  1004.                 $horaire->getFin() > $time
  1005.             ) {
  1006.                 return $horaire;
  1007.             }
  1008.         }
  1009.         return null;
  1010.     }
  1011.     private function getOtherHoraireOwnDay($jour$time): ?IctusHoraire
  1012.     {
  1013.         foreach ($this->getIctusHoraires() as $horaire) {
  1014.             if (
  1015.                 $horaire->getJour() === $jour &&
  1016.                 $horaire->getFin() > $time
  1017.             ) {
  1018.                 return $horaire;
  1019.             }
  1020.         }
  1021.         return null;
  1022.     }
  1023.     private function getOtherHoraireNextDay($jour): ?IctusHoraire
  1024.     {
  1025.         $resultats = [];
  1026.         foreach ($this->getIctusHoraires() as $horaire) {
  1027.             if ($horaire->getJour() > $jour) {
  1028.                 $resultats[] = $horaire;
  1029.             }
  1030.         }
  1031.         usort($resultats, function ($a$b) {
  1032.             return $a->getDebut() <=> $b->getDebut();
  1033.         });
  1034.         return $resultats[0] ?? null;
  1035.     }
  1036.     private function getFirstHoraire(): ?IctusHoraire
  1037.     {
  1038.         $horaires $this->getIctusHoraires()->toArray();
  1039.         if (empty($horaires)) {
  1040.             return null;
  1041.         }
  1042.         usort($horaires, function ($a$b) {
  1043.             $cmpJour $a->getJour() <=> $b->getJour();
  1044.             return $cmpJour !== $cmpJour : ($a->getDebut() <=> $b->getDebut());
  1045.         });
  1046.         return $horaires[0] ?? null;
  1047.     }
  1048.     /**
  1049.      * @return Collection<int, Assurance>
  1050.      */
  1051.     public function getAssurances(): Collection
  1052.     {
  1053.         return $this->assurances;
  1054.     }
  1055.     public function addAssurance(Assurance $assurance): self
  1056.     {
  1057.         if (!$this->assurances->contains($assurance)) {
  1058.             $this->assurances[] = $assurance;
  1059.             $assurance->addPharmacie($this);
  1060.         }
  1061.         return $this;
  1062.     }
  1063.     public function removeAssurance(Assurance $assurance): self
  1064.     {
  1065.         if ($this->assurances->removeElement($assurance)) {
  1066.             $assurance->removePharmacie($this);
  1067.         }
  1068.         return $this;
  1069.     }
  1070.     /**
  1071.      * @return Collection<int, CertCertificat>
  1072.      */
  1073.     public function getCertCertificats(): Collection
  1074.     {
  1075.         return $this->certCertificats;
  1076.     }
  1077.     public function addCertCertificat(CertCertificat $certCertificat): self
  1078.     {
  1079.         if (!$this->certCertificats->contains($certCertificat)) {
  1080.             $this->certCertificats[] = $certCertificat;
  1081.             $certCertificat->setPharmacie($this);
  1082.         }
  1083.         return $this;
  1084.     }
  1085.     public function removeCertCertificat(CertCertificat $certCertificat): self
  1086.     {
  1087.         if ($this->certCertificats->removeElement($certCertificat)) {
  1088.             // set the owning side to null (unless already changed)
  1089.             if ($certCertificat->getPharmacie() === $this) {
  1090.                 $certCertificat->setPharmacie(null);
  1091.             }
  1092.         }
  1093.         return $this;
  1094.     }
  1095. }