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.     public function __construct()
  185.     {
  186.         $this->stockpharmacies = new ArrayCollection();
  187.         $this->users           = new ArrayCollection();
  188.         $this->uuid            uniqid((new \DateTime())->format('YmdHis'));
  189.         $this->livraisonPharmacies = new ArrayCollection();
  190.         $this->ictusPaiementPharmacies = new ArrayCollection();
  191.         $this->ictusHoraires = new ArrayCollection();
  192.         $this->ictusCommandes = new ArrayCollection();
  193.         $this->ictoRemboursements = new ArrayCollection();
  194.         $this->ictoParampovs = new ArrayCollection();
  195.         $this->ictoMouvements = new ArrayCollection();
  196.         $this->achatIctocoins = new ArrayCollection();
  197.         $this->ictusPanierSpecials = new ArrayCollection();
  198.         $this->commandeSpecials = new ArrayCollection();
  199.         $this->facturePatients = new ArrayCollection();
  200.         $this->productBlackLists = new ArrayCollection();
  201.         $this->historiqueMajs = new ArrayCollection();
  202.         $this->tierpayants = new ArrayCollection();
  203.         $this->parcours = new ArrayCollection();
  204.         $this->facturePharmacies = new ArrayCollection();
  205.         $this->rates = new ArrayCollection();
  206.         $this->ictusReclamations = new ArrayCollection();
  207.         $this->remiseUserPharmacies = new ArrayCollection();
  208.     }
  209.     public function getId(): ?int
  210.     {
  211.         return $this->id;
  212.     }
  213.     public function setId($id)
  214.     {
  215.         $this->id $id;
  216.         return $this;
  217.     }
  218.     public function getUuid(): ?string
  219.     {
  220.         return $this->uuid;
  221.     }
  222.     public function setUuid(?string $uuid): self
  223.     {
  224.         $this->uuid $uuid;
  225.         return $this;
  226.     }
  227.     public function getDesignation(): ?string
  228.     {
  229.         return $this->designation;
  230.     }
  231.     public function setDesignation(string $designation): self
  232.     {
  233.         $this->designation $designation;
  234.         return $this;
  235.     }
  236.     public function getLogo(): ?string
  237.     {
  238.         return $this->logo;
  239.     }
  240.     public function setLogo(?string $logo): self
  241.     {
  242.         $this->logo $logo;
  243.         return $this;
  244.     }
  245.     public function getNumeroordre(): ?string
  246.     {
  247.         return $this->numeroordre;
  248.     }
  249.     public function setNumeroordre(?string $numeroordre): self
  250.     {
  251.         $this->numeroordre $numeroordre;
  252.         return $this;
  253.     }
  254.     public function getNif(): ?string
  255.     {
  256.         return $this->nif;
  257.     }
  258.     public function setNif(?string $nif): self
  259.     {
  260.         $this->nif $nif;
  261.         return $this;
  262.     }
  263.     public function getStat(): ?string
  264.     {
  265.         return $this->stat;
  266.     }
  267.     public function setStat(?string $stat): self
  268.     {
  269.         $this->stat $stat;
  270.         return $this;
  271.     }
  272.     public function isIsValid(): ?bool
  273.     {
  274.         return $this->isValid;
  275.     }
  276.     public function setIsValid(?bool $isValid): self
  277.     {
  278.         $this->isValid $isValid;
  279.         return $this;
  280.     }
  281.     public function getLogitude(): ?float
  282.     {
  283.         return $this->logitude;
  284.     }
  285.     public function setLogitude(?float $logitude): self
  286.     {
  287.         $this->logitude $logitude;
  288.         return $this;
  289.     }
  290.     public function getLatitude(): ?float
  291.     {
  292.         return $this->latitude;
  293.     }
  294.     public function setLatitude(?float $latitude): self
  295.     {
  296.         $this->latitude $latitude;
  297.         return $this;
  298.     }
  299.     /**
  300.      * @return Collection<int, Stockpharmacie>
  301.      */
  302.     public function getStockpharmacies(): Collection
  303.     {
  304.         return $this->stockpharmacies;
  305.     }
  306.     public function addStockpharmacy(Stockpharmacie $stockpharmacy): self
  307.     {
  308.         if (!$this->stockpharmacies->contains($stockpharmacy)) {
  309.             $this->stockpharmacies[] = $stockpharmacy;
  310.             $stockpharmacy->setIctuspharmacie($this);
  311.         }
  312.         return $this;
  313.     }
  314.     public function removeStockpharmacy(Stockpharmacie $stockpharmacy): self
  315.     {
  316.         if ($this->stockpharmacies->removeElement($stockpharmacy)) {
  317.             // set the owning side to null (unless already changed)
  318.             if ($stockpharmacy->getIctuspharmacie() === $this) {
  319.                 $stockpharmacy->setIctuspharmacie(null);
  320.             }
  321.         }
  322.         return $this;
  323.     }
  324.     /**
  325.      * @return Collection<int, User>
  326.      */
  327.     public function getUsers(): Collection
  328.     {
  329.         return $this->users;
  330.     }
  331.     public function addUser(User $user): self
  332.     {
  333.         if (!$this->users->contains($user)) {
  334.             $this->users[] = $user;
  335.             $user->setIctusPharmacie($this);
  336.         }
  337.         return $this;
  338.     }
  339.     public function removeUser(User $user): self
  340.     {
  341.         if ($this->users->removeElement($user)) {
  342.             // set the owning side to null (unless already changed)
  343.             if ($user->getIctusPharmacie() === $this) {
  344.                 $user->setIctusPharmacie(null);
  345.             }
  346.         }
  347.         return $this;
  348.     }
  349.     public function getAdresse(): ?string
  350.     {
  351.         return $this->adresse;
  352.     }
  353.     public function setAdresse(?string $adresse): self
  354.     {
  355.         $this->adresse $adresse;
  356.         return $this;
  357.     }
  358.     public function getQuartier(): ?Quartier
  359.     {
  360.         return $this->quartier;
  361.     }
  362.     public function setQuartier(?Quartier $quartier): self
  363.     {
  364.         $this->quartier $quartier;
  365.         return $this;
  366.     }
  367.     /**
  368.      * @return Collection<int, LivraisonPharmacie>
  369.      */
  370.     public function getLivraisonPharmacies(): Collection
  371.     {
  372.         return $this->livraisonPharmacies;
  373.     }
  374.     public function addLivraisonPharmacy(LivraisonPharmacie $livraisonPharmacy): self
  375.     {
  376.         if (!$this->livraisonPharmacies->contains($livraisonPharmacy)) {
  377.             $this->livraisonPharmacies[] = $livraisonPharmacy;
  378.             $livraisonPharmacy->setIctusPharmacie($this);
  379.         }
  380.         return $this;
  381.     }
  382.     public function removeLivraisonPharmacy(LivraisonPharmacie $livraisonPharmacy): self
  383.     {
  384.         if ($this->livraisonPharmacies->removeElement($livraisonPharmacy)) {
  385.             // set the owning side to null (unless already changed)
  386.             if ($livraisonPharmacy->getIctusPharmacie() === $this) {
  387.                 $livraisonPharmacy->setIctusPharmacie(null);
  388.             }
  389.         }
  390.         return $this;
  391.     }
  392.     /**
  393.      * @return Collection<int, IctusPaiementPharmacie>
  394.      */
  395.     public function getIctusPaiementPharmacies(): Collection
  396.     {
  397.         return $this->ictusPaiementPharmacies;
  398.     }
  399.     public function addIctusPaiementPharmacy(IctusPaiementPharmacie $ictusPaiementPharmacy): self
  400.     {
  401.         if (!$this->ictusPaiementPharmacies->contains($ictusPaiementPharmacy)) {
  402.             $this->ictusPaiementPharmacies[] = $ictusPaiementPharmacy;
  403.             $ictusPaiementPharmacy->setPharmacie($this);
  404.         }
  405.         return $this;
  406.     }
  407.     public function removeIctusPaiementPharmacy(IctusPaiementPharmacie $ictusPaiementPharmacy): self
  408.     {
  409.         if ($this->ictusPaiementPharmacies->removeElement($ictusPaiementPharmacy)) {
  410.             // set the owning side to null (unless already changed)
  411.             if ($ictusPaiementPharmacy->getPharmacie() === $this) {
  412.                 $ictusPaiementPharmacy->setPharmacie(null);
  413.             }
  414.         }
  415.         return $this;
  416.     }
  417.     /**
  418.      * @return Collection<int, IctusHoraire>
  419.      */
  420.     public function getIctusHoraires(): Collection
  421.     {
  422.         return $this->ictusHoraires;
  423.     }
  424.     public function addIctusHoraire(IctusHoraire $ictusHoraire): self
  425.     {
  426.         if (!$this->ictusHoraires->contains($ictusHoraire)) {
  427.             $this->ictusHoraires[] = $ictusHoraire;
  428.             $ictusHoraire->setIctusPharmacie($this);
  429.         }
  430.         return $this;
  431.     }
  432.     public function removeIctusHoraire(IctusHoraire $ictusHoraire): self
  433.     {
  434.         if ($this->ictusHoraires->removeElement($ictusHoraire)) {
  435.             // set the owning side to null (unless already changed)
  436.             if ($ictusHoraire->getIctusPharmacie() === $this) {
  437.                 $ictusHoraire->setIctusPharmacie(null);
  438.             }
  439.         }
  440.         return $this;
  441.     }
  442.     /**
  443.      * @return Collection<int, IctusCommande>
  444.      */
  445.     public function getIctusCommandes(): Collection
  446.     {
  447.         return $this->ictusCommandes;
  448.     }
  449.     public function addIctusCommande(IctusCommande $ictusCommande): self
  450.     {
  451.         if (!$this->ictusCommandes->contains($ictusCommande)) {
  452.             $this->ictusCommandes[] = $ictusCommande;
  453.             $ictusCommande->setPharmacie($this);
  454.         }
  455.         return $this;
  456.     }
  457.     public function removeIctusCommande(IctusCommande $ictusCommande): self
  458.     {
  459.         if ($this->ictusCommandes->removeElement($ictusCommande)) {
  460.             // set the owning side to null (unless already changed)
  461.             if ($ictusCommande->getPharmacie() === $this) {
  462.                 $ictusCommande->setPharmacie(null);
  463.             }
  464.         }
  465.         return $this;
  466.     }
  467.     /**
  468.      * Get the value of distanceParRapportPatient
  469.      */
  470.     public function getDistanceParRapportPatient()
  471.     {
  472.         return $this->distanceParRapportPatient;
  473.     }
  474.     /**
  475.      * Set the value of distanceParRapportPatient
  476.      *
  477.      * @return  self
  478.      */
  479.     public function setDistanceParRapportPatient($distanceParRapportPatient)
  480.     {
  481.         $this->distanceParRapportPatient $distanceParRapportPatient;
  482.         return $this;
  483.     }
  484.     public function getPhotocouverture(): ?string
  485.     {
  486.         return $this->photocouverture;
  487.     }
  488.     public function setPhotocouverture(?string $photocouverture): self
  489.     {
  490.         $this->photocouverture $photocouverture;
  491.         return $this;
  492.     }
  493.     public function getPagename(): ?string
  494.     {
  495.         return $this->pagename;
  496.     }
  497.     public function setPagename(?string $pagename): self
  498.     {
  499.         $this->pagename $pagename;
  500.         return $this;
  501.     }
  502.     /**
  503.      * @return Collection<int, IctoRemboursement>
  504.      */
  505.     public function getIctoRemboursements(): Collection
  506.     {
  507.         return $this->ictoRemboursements;
  508.     }
  509.     public function addIctoRemboursement(IctoRemboursement $ictoRemboursement): self
  510.     {
  511.         if (!$this->ictoRemboursements->contains($ictoRemboursement)) {
  512.             $this->ictoRemboursements[] = $ictoRemboursement;
  513.             $ictoRemboursement->setDemandeur($this);
  514.         }
  515.         return $this;
  516.     }
  517.     public function removeIctoRemboursement(IctoRemboursement $ictoRemboursement): self
  518.     {
  519.         if ($this->ictoRemboursements->removeElement($ictoRemboursement)) {
  520.             // set the owning side to null (unless already changed)
  521.             if ($ictoRemboursement->getDemandeur() === $this) {
  522.                 $ictoRemboursement->setDemandeur(null);
  523.             }
  524.         }
  525.         return $this;
  526.     }
  527.     /**
  528.      * @return Collection<int, IctoParampov>
  529.      */
  530.     public function getIctoParampovs(): Collection
  531.     {
  532.         return $this->ictoParampovs;
  533.     }
  534.     public function addIctoParampov(IctoParampov $ictoParampov): self
  535.     {
  536.         if (!$this->ictoParampovs->contains($ictoParampov)) {
  537.             $this->ictoParampovs[] = $ictoParampov;
  538.             $ictoParampov->setPharmacie($this);
  539.         }
  540.         return $this;
  541.     }
  542.     public function removeIctoParampov(IctoParampov $ictoParampov): self
  543.     {
  544.         if ($this->ictoParampovs->removeElement($ictoParampov)) {
  545.             // set the owning side to null (unless already changed)
  546.             if ($ictoParampov->getPharmacie() === $this) {
  547.                 $ictoParampov->setPharmacie(null);
  548.             }
  549.         }
  550.         return $this;
  551.     }
  552.     /**
  553.      * @return Collection<int, IctoMouvement>
  554.      */
  555.     public function getIctoMouvements(): Collection
  556.     {
  557.         return $this->ictoMouvements;
  558.     }
  559.     public function addIctoMouvement(IctoMouvement $ictoMouvement): self
  560.     {
  561.         if (!$this->ictoMouvements->contains($ictoMouvement)) {
  562.             $this->ictoMouvements[] = $ictoMouvement;
  563.             $ictoMouvement->setPharmacie($this);
  564.         }
  565.         return $this;
  566.     }
  567.     public function removeIctoMouvement(IctoMouvement $ictoMouvement): self
  568.     {
  569.         if ($this->ictoMouvements->removeElement($ictoMouvement)) {
  570.             // set the owning side to null (unless already changed)
  571.             if ($ictoMouvement->getPharmacie() === $this) {
  572.                 $ictoMouvement->setPharmacie(null);
  573.             }
  574.         }
  575.         return $this;
  576.     }
  577.     /**
  578.      * @return Collection<int, AchatIctocoin>
  579.      */
  580.     public function getAchatIctocoins(): Collection
  581.     {
  582.         return $this->achatIctocoins;
  583.     }
  584.     public function addAchatIctocoin(AchatIctocoin $achatIctocoin): self
  585.     {
  586.         if (!$this->achatIctocoins->contains($achatIctocoin)) {
  587.             $this->achatIctocoins[] = $achatIctocoin;
  588.             $achatIctocoin->setPharmacie($this);
  589.         }
  590.         return $this;
  591.     }
  592.     public function removeAchatIctocoin(AchatIctocoin $achatIctocoin): self
  593.     {
  594.         if ($this->achatIctocoins->removeElement($achatIctocoin)) {
  595.             // set the owning side to null (unless already changed)
  596.             if ($achatIctocoin->getPharmacie() === $this) {
  597.                 $achatIctocoin->setPharmacie(null);
  598.             }
  599.         }
  600.         return $this;
  601.     }
  602.     /**
  603.      * @return Collection<int, IctusPanierSpecial>
  604.      */
  605.     public function getIctusPanierSpecials(): Collection
  606.     {
  607.         return $this->ictusPanierSpecials;
  608.     }
  609.     public function addIctusPanierSpecial(IctusPanierSpecial $ictusPanierSpecial): self
  610.     {
  611.         if (!$this->ictusPanierSpecials->contains($ictusPanierSpecial)) {
  612.             $this->ictusPanierSpecials[] = $ictusPanierSpecial;
  613.             $ictusPanierSpecial->setPharmacie($this);
  614.         }
  615.         return $this;
  616.     }
  617.     public function removeIctusPanierSpecial(IctusPanierSpecial $ictusPanierSpecial): self
  618.     {
  619.         if ($this->ictusPanierSpecials->removeElement($ictusPanierSpecial)) {
  620.             // set the owning side to null (unless already changed)
  621.             if ($ictusPanierSpecial->getPharmacie() === $this) {
  622.                 $ictusPanierSpecial->setPharmacie(null);
  623.             }
  624.         }
  625.         return $this;
  626.     }
  627.     public function isIsCommandeSpecial(): ?bool
  628.     {
  629.         return $this->isCommandeSpecial;
  630.     }
  631.     public function setIsCommandeSpecial(?bool $isCommandeSpecial): self
  632.     {
  633.         $this->isCommandeSpecial $isCommandeSpecial;
  634.         return $this;
  635.     }
  636.     /**
  637.      * @return Collection<int, CommandeSpecial>
  638.      */
  639.     public function getCommandeSpecials(): Collection
  640.     {
  641.         return $this->commandeSpecials;
  642.     }
  643.     public function addCommandeSpecial(CommandeSpecial $commandeSpecial): self
  644.     {
  645.         if (!$this->commandeSpecials->contains($commandeSpecial)) {
  646.             $this->commandeSpecials[] = $commandeSpecial;
  647.             $commandeSpecial->setPharmacie($this);
  648.         }
  649.         return $this;
  650.     }
  651.     public function removeCommandeSpecial(CommandeSpecial $commandeSpecial): self
  652.     {
  653.         if ($this->commandeSpecials->removeElement($commandeSpecial)) {
  654.             // set the owning side to null (unless already changed)
  655.             if ($commandeSpecial->getPharmacie() === $this) {
  656.                 $commandeSpecial->setPharmacie(null);
  657.             }
  658.         }
  659.         return $this;
  660.     }
  661.     public function isIsValideAutomatique(): ?bool
  662.     {
  663.         return $this->isValideAutomatique;
  664.     }
  665.     public function setIsValideAutomatique(?bool $isValideAutomatique): self
  666.     {
  667.         $this->isValideAutomatique $isValideAutomatique;
  668.         return $this;
  669.     }
  670.     public function getPourcentageCommandeSpecial(): ?float
  671.     {
  672.         return $this->pourcentageCommandeSpecial;
  673.     }
  674.     public function setPourcentageCommandeSpecial(?float $pourcentageCommandeSpecial): self
  675.     {
  676.         $this->pourcentageCommandeSpecial $pourcentageCommandeSpecial;
  677.         return $this;
  678.     }
  679.     /**
  680.      * @return Collection<int, FacturePatient>
  681.      */
  682.     public function getFacturePatients(): Collection
  683.     {
  684.         return $this->facturePatients;
  685.     }
  686.     public function addFacturePatient(FacturePatient $facturePatient): self
  687.     {
  688.         if (!$this->facturePatients->contains($facturePatient)) {
  689.             $this->facturePatients[] = $facturePatient;
  690.             $facturePatient->setPharmacie($this);
  691.         }
  692.         return $this;
  693.     }
  694.     public function removeFacturePatient(FacturePatient $facturePatient): self
  695.     {
  696.         if ($this->facturePatients->removeElement($facturePatient)) {
  697.             // set the owning side to null (unless already changed)
  698.             if ($facturePatient->getPharmacie() === $this) {
  699.                 $facturePatient->setPharmacie(null);
  700.             }
  701.         }
  702.         return $this;
  703.     }
  704.     public function getRcs(): ?string
  705.     {
  706.         return $this->rcs;
  707.     }
  708.     public function setRcs(?string $rcs): self
  709.     {
  710.         $this->rcs $rcs;
  711.         return $this;
  712.     }
  713.     /**
  714.      * @return Collection<int, ProductBlackList>
  715.      */
  716.     public function getProductBlackLists(): Collection
  717.     {
  718.         return $this->productBlackLists;
  719.     }
  720.     public function addProductBlackList(ProductBlackList $productBlackList): self
  721.     {
  722.         if (!$this->productBlackLists->contains($productBlackList)) {
  723.             $this->productBlackLists[] = $productBlackList;
  724.             $productBlackList->setPharmacie($this);
  725.         }
  726.         return $this;
  727.     }
  728.     public function removeProductBlackList(ProductBlackList $productBlackList): self
  729.     {
  730.         if ($this->productBlackLists->removeElement($productBlackList)) {
  731.             // set the owning side to null (unless already changed)
  732.             if ($productBlackList->getPharmacie() === $this) {
  733.                 $productBlackList->setPharmacie(null);
  734.             }
  735.         }
  736.         return $this;
  737.     }
  738.     /**
  739.      * @return Collection<int, HistoriqueMaj>
  740.      */
  741.     public function getHistoriqueMajs(): Collection
  742.     {
  743.         return $this->historiqueMajs;
  744.     }
  745.     public function addHistoriqueMaj(HistoriqueMaj $historiqueMaj): self
  746.     {
  747.         if (!$this->historiqueMajs->contains($historiqueMaj)) {
  748.             $this->historiqueMajs[] = $historiqueMaj;
  749.             $historiqueMaj->setPharmacie($this);
  750.         }
  751.         return $this;
  752.     }
  753.     public function removeHistoriqueMaj(HistoriqueMaj $historiqueMaj): self
  754.     {
  755.         if ($this->historiqueMajs->removeElement($historiqueMaj)) {
  756.             // set the owning side to null (unless already changed)
  757.             if ($historiqueMaj->getPharmacie() === $this) {
  758.                 $historiqueMaj->setPharmacie(null);
  759.             }
  760.         }
  761.         return $this;
  762.     }
  763.     /**
  764.      * @return Collection<int, Tierpayant>
  765.      */
  766.     public function getTierpayants(): Collection
  767.     {
  768.         return $this->tierpayants;
  769.     }
  770.     public function addTierpayant(Tierpayant $tierpayant): self
  771.     {
  772.         if (!$this->tierpayants->contains($tierpayant)) {
  773.             $this->tierpayants[] = $tierpayant;
  774.             $tierpayant->addPharmacie($this);
  775.         }
  776.         return $this;
  777.     }
  778.     public function removeTierpayant(Tierpayant $tierpayant): self
  779.     {
  780.         if ($this->tierpayants->removeElement($tierpayant)) {
  781.             $tierpayant->removePharmacie($this);
  782.         }
  783.         return $this;
  784.     }
  785.     public function getMailResponsable(): ?string
  786.     {
  787.         return $this->mailResponsable;
  788.     }
  789.     public function setMailResponsable(?string $mailResponsable): self
  790.     {
  791.         $this->mailResponsable $mailResponsable;
  792.         return $this;
  793.     }
  794.     /**
  795.      * @return Collection<int, FacturePharmacie>
  796.      */
  797.     public function getFacturePharmacies(): Collection
  798.     {
  799.         return $this->facturePharmacies;
  800.     }
  801.     public function addFacturePharmacy(FacturePharmacie $facturePharmacy): self
  802.     {
  803.         if (!$this->facturePharmacies->contains($facturePharmacy)) {
  804.             $this->facturePharmacies[] = $facturePharmacy;
  805.             $facturePharmacy->setPharmacie($this);
  806.         }
  807.         return $this;
  808.     }
  809.     public function removeFacturePharmacy(FacturePharmacie $facturePharmacy): self
  810.     {
  811.         if ($this->facturePharmacies->removeElement($facturePharmacy)) {
  812.             // set the owning side to null (unless already changed)
  813.             if ($facturePharmacy->getPharmacie() === $this) {
  814.                 $facturePharmacy->setPharmacie(null);
  815.             }
  816.         }
  817.         return $this;
  818.     }
  819.     /**
  820.      * @return Collection<int, Rate>
  821.      */
  822.     public function getRates(): Collection
  823.     {
  824.         return $this->rates;
  825.     }
  826.     public function addRate(Rate $rate): self
  827.     {
  828.         if (!$this->rates->contains($rate)) {
  829.             $this->rates[] = $rate;
  830.             $rate->setPharmacie($this);
  831.         }
  832.         return $this;
  833.     }
  834.     public function removeRate(Rate $rate): self
  835.     {
  836.         if ($this->rates->removeElement($rate)) {
  837.             // set the owning side to null (unless already changed)
  838.             if ($rate->getPharmacie() === $this) {
  839.                 $rate->setPharmacie(null);
  840.             }
  841.         }
  842.         return $this;
  843.     }
  844.     /**
  845.      * @return Collection<int, IctusReclamation>
  846.      */
  847.     public function getIctusReclamations(): Collection
  848.     {
  849.         return $this->ictusReclamations;
  850.     }
  851.     public function addIctusReclamation(IctusReclamation $ictusReclamation): self
  852.     {
  853.         if (!$this->ictusReclamations->contains($ictusReclamation)) {
  854.             $this->ictusReclamations[] = $ictusReclamation;
  855.             $ictusReclamation->setPharmacie($this);
  856.         }
  857.         return $this;
  858.     }
  859.     public function removeIctusReclamation(IctusReclamation $ictusReclamation): self
  860.     {
  861.         if ($this->ictusReclamations->removeElement($ictusReclamation)) {
  862.             // set the owning side to null (unless already changed)
  863.             if ($ictusReclamation->getPharmacie() === $this) {
  864.                 $ictusReclamation->setPharmacie(null);
  865.             }
  866.         }
  867.         return $this;
  868.     }
  869.     public function getRealDesignation(): ?string
  870.     {
  871.         return $this->realDesignation;
  872.     }
  873.     public function setRealDesignation(?string $realDesignation): self
  874.     {
  875.         $this->realDesignation $realDesignation;
  876.         return $this;
  877.     }
  878.     /**
  879.      * @return Collection<int, RemiseUserPharmacie>
  880.      */
  881.     public function getRemiseUserPharmacies(): Collection
  882.     {
  883.         return $this->remiseUserPharmacies;
  884.     }
  885.     public function addRemiseUserPharmacy(RemiseUserPharmacie $remiseUserPharmacy): self
  886.     {
  887.         if (!$this->remiseUserPharmacies->contains($remiseUserPharmacy)) {
  888.             $this->remiseUserPharmacies[] = $remiseUserPharmacy;
  889.             $remiseUserPharmacy->setPharmacie($this);
  890.         }
  891.         return $this;
  892.     }
  893.     public function removeRemiseUserPharmacy(RemiseUserPharmacie $remiseUserPharmacy): self
  894.     {
  895.         if ($this->remiseUserPharmacies->removeElement($remiseUserPharmacy)) {
  896.             // set the owning side to null (unless already changed)
  897.             if ($remiseUserPharmacy->getPharmacie() === $this) {
  898.                 $remiseUserPharmacy->setPharmacie(null);
  899.             }
  900.         }
  901.         return $this;
  902.     }
  903.     /**
  904.      * @param float $userLatitude
  905.      * @param float $userLongitude
  906.      */
  907.     public function getDistance(float $userLatitudefloat $userLongitude): ?float
  908.     {
  909.         $rayonDeLaTerre 6371071.03;
  910.         if ($this->latitude === null || $this->logitude === null) {
  911.             return null;
  912.         }
  913.         $lat1 deg2rad($userLatitude);
  914.         $lon1 deg2rad($userLongitude);
  915.         $lat2 deg2rad($this->latitude);
  916.         $lon2 deg2rad($this->logitude);
  917.         $deltaLat $lat2 $lat1;
  918.         $deltaLon $lon2 $lon1;
  919.         $a sin($deltaLat 2) ** cos($lat1) * cos($lat2) * sin($deltaLon 2) ** 2;
  920.         $c asin(sqrt($a));
  921.         return $rayonDeLaTerre $c;
  922.     }
  923.     public function checkHorraire(): ?array
  924.     {
  925.         $dateSemaine = ['Monday' => 1'Tuesday' => 2'Wednesday' => 3'Thursday' => 4'Friday' => 5'Saturday' => 6'Sunday' => 7];
  926.         $result['classHoraire'] = "";
  927.         $result['textHoraire'] = "";
  928.         $result['descHoraire'] = "";
  929.         $dateTimeNow = new DateTime();
  930.         $dateTimeNow->modify('+2 hours');
  931.         if (count($this->getIctusHoraires()) > 0) {
  932.             $jour $dateSemaine[date("l"strtotime($dateTimeNow->format('Y-m-d')))];
  933.             $time $dateTimeNow->format('H:i:s');
  934.             $horaireNow $this->verifHoraireByTime($jour$time);
  935.             if ($horaireNow) {
  936.                 $heureDebut = new \DateTime($time);
  937.                 $heureFin = new \DateTime($horaireNow->getFin());
  938.                 $diff $heureDebut->diff($heureFin);
  939.                 $result['classHoraire'] = "bg-success text-white";
  940.                 $result['textHoraire'] = 'Ouverte';
  941.                 $result['descHoraire'] = 'sera fermée dans ' $diff->format('%Hh %Imn');
  942.             } else {
  943.                 $result['classHoraire'] = "bg-danger text-white";
  944.                 $result['textHoraire'] = 'Fermée';
  945.                 $horaireOtherOwnDay $this->getOtherHoraireOwnDay($jour$time);
  946.                 if ($horaireOtherOwnDay) {
  947.                     $heureDebut = new \DateTime($time);
  948.                     $heureFin = new \DateTime($horaireOtherOwnDay->getDebut());
  949.                     $diff $heureDebut->diff($heureFin);
  950.                     $result['descHoraire'] = 'sera ouverte dans ' $diff->format('%Hh %Imn');
  951.                 } else {
  952.                     $horaireOtherDay $this->getOtherHoraireNextDay($jour);
  953.                     if ($horaireOtherDay) {
  954.                         $diffDay = (int)$horaireOtherDay[0]->getJour() - $jour;
  955.                         $dateDebut = new \DateTime($dateTimeNow->format('Y-m-d H:i:s'));
  956.                         $dateFin = new \DateTime(date('Y-m-d ' $horaireOtherDay[0]->getDebut(), strtotime(' + ' $diffDay ' days')));
  957.                         $diff $dateDebut->diff($dateFin);
  958.                         $delais "";
  959.                         if ((int)$diff->format('%d') == 0) {
  960.                             $delais $diff->format('%Hh %Imn');
  961.                         } else {
  962.                             $delais $diff->format('%dj');
  963.                         }
  964.                         $result['descHoraire'] = 'sera ouverte dans ' $delais;
  965.                     } else {
  966.                         $horaireDebusSemaine $this->getFirstHoraire($jour);
  967.                         if ($horaireDebusSemaine) {
  968.                             $diffDay = (int)$horaireDebusSemaine->getJour() + ($jour);
  969.                             $dateDebut = new \DateTime($dateTimeNow->format('Y-m-d H:i:s'));
  970.                             $dateFin = new \DateTime(date('Y-m-d ' $horaireDebusSemaine->getDebut(), strtotime(' + ' $diffDay ' days')));
  971.                             $diff $dateDebut->diff($dateFin);
  972.                             $delais "";
  973.                             if ((int)$diff->format('%d') == 0) {
  974.                                 $delais $diff->format('%Hh %Imn');
  975.                             } else {
  976.                                 $delais $diff->format('%dj');
  977.                             }
  978.                             $result['descHoraire'] = 'sera ouverte dans ' $delais;
  979.                         }
  980.                     }
  981.                 }
  982.             }
  983.         } else {
  984.             $result null;
  985.         }
  986.         return $result;
  987.     }
  988.     private function verifHoraireByTime($jour$time): ?IctusHoraire
  989.     {
  990.         foreach ($this->getIctusHoraires() as $horaire) {
  991.             if (
  992.                 $horaire->getJour() === $jour &&
  993.                 $horaire->getDebut() <= $time &&
  994.                 $horaire->getFin() > $time
  995.             ) {
  996.                 return $horaire;
  997.             }
  998.         }
  999.         return null;
  1000.     }
  1001.     private function getOtherHoraireOwnDay($jour$time): ?IctusHoraire
  1002.     {
  1003.         foreach ($this->getIctusHoraires() as $horaire) {
  1004.             if (
  1005.                 $horaire->getJour() === $jour &&
  1006.                 $horaire->getFin() > $time
  1007.             ) {
  1008.                 return $horaire;
  1009.             }
  1010.         }
  1011.         return null;
  1012.     }
  1013.     private function getOtherHoraireNextDay($jour): ?IctusHoraire
  1014.     {
  1015.         $resultats = [];
  1016.         foreach ($this->getIctusHoraires() as $horaire) {
  1017.             if ($horaire->getJour() > $jour) {
  1018.                 $resultats[] = $horaire;
  1019.             }
  1020.         }
  1021.         usort($resultats, function ($a$b) {
  1022.             return $a->getDebut() <=> $b->getDebut();
  1023.         });
  1024.         return $resultats[0] ?? null;
  1025.     }
  1026.     private function getFirstHoraire(): ?IctusHoraire
  1027.     {
  1028.         $horaires $this->getIctusHoraires()->toArray();
  1029.         if (empty($horaires)) {
  1030.             return null;
  1031.         }
  1032.         usort($horaires, function ($a$b) {
  1033.             $cmpJour $a->getJour() <=> $b->getJour();
  1034.             return $cmpJour !== $cmpJour : ($a->getDebut() <=> $b->getDebut());
  1035.         });
  1036.         return $horaires[0] ?? null;
  1037.     }
  1038. }