src/Entity/CentreGroupe.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Controller\AdminController;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use App\Repository\CentreGroupeRepository;
  7. use Doctrine\Common\Collections\Collection;
  8. use Symfony\Contracts\Cache\CacheInterface;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. /**
  11.  * @ORM\Entity(repositoryClass=CentreGroupeRepository::class)
  12.  */
  13. class CentreGroupe
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=50)
  23.      */
  24.     private $cg_nom;
  25.     /**
  26.      * @ORM\Column(type="integer")
  27.      */
  28.     private $cg_pas_horaires;
  29.     /**
  30.      * @ORM\Column(type="boolean")
  31.      */
  32.     private $cg_actif;
  33.     /**
  34.      * @ORM\Column(type="boolean")
  35.      */
  36.     private $cg_stay_to_date_rdv;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity=Ligne::class, mappedBy="centre_groupe")
  39.      */
  40.     private $lignes;
  41.     /**
  42.      * @ORM\OneToMany(targetEntity=TypeVehicule::class, mappedBy="centre_groupe")
  43.      */
  44.     private $typeVehicules;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=TypeVisite::class, mappedBy="centre_groupe")
  47.      */
  48.     private $typeVisites;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity=CentrePrestation::class, mappedBy="centre_groupe", fetch="EAGER")
  51.      */
  52.     private $centrePrestations;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=Promotion::class, mappedBy="centre_groupe")
  55.      */
  56.     private $promotions;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity=CentreCouponPromotion::class, mappedBy="centre_groupe", orphanRemoval=true)
  59.      */
  60.     private $centreCouponPromotions;
  61.     /**
  62.      * @ORM\ManyToOne(targetEntity=Gerant::class, inversedBy="centreGroupes")
  63.      */
  64.     private $cg_gerant;
  65.     /**
  66.      * @ORM\ManyToOne(targetEntity=CentreGroupeCss::class, inversedBy="centreGroupes", fetch="EAGER")
  67.      */
  68.     private $centre_groupe_css;
  69.     /**
  70.      * @ORM\OneToMany(targetEntity=ClientCompte::class, mappedBy="centre_groupe", orphanRemoval=true)
  71.      */
  72.     private $clientComptes;
  73.     /**
  74.      * @ORM\OneToMany(targetEntity=Centre::class, mappedBy="centre_groupe", orphanRemoval=true, fetch="EAGER")
  75.      */
  76.     private $centres;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity=CentrePartenaire::class, mappedBy="centre_groupe", orphanRemoval=true)
  79.      */
  80.     private $centrePartenaires;
  81.     /**
  82.      * @ORM\Column(type="integer",  nullable=true)
  83.      */
  84.     private $id_old;
  85.     /**
  86.      * @ORM\OneToMany(targetEntity=Utilisateur::class, mappedBy="CentreGroupe", orphanRemoval=true)
  87.      * @ORM\JoinColumn(nullable=true)
  88.      */
  89.     private $utilisateurs;
  90.     protected $em;
  91.     /**
  92.      * @ORM\Column(type="string", length=30, nullable=true)
  93.      */
  94.     private $cg_serveur;
  95.     public function __construct()
  96.     {
  97.         $this->lignes = new ArrayCollection();
  98.         $this->typeVehicules = new ArrayCollection();
  99.         $this->typeVisites = new ArrayCollection();
  100.         $this->centrePrestations = new ArrayCollection();
  101.         $this->promotions = new ArrayCollection();
  102.         $this->centreCouponPromotions = new ArrayCollection();
  103.         $this->clientComptes = new ArrayCollection();
  104.         $this->centres = new ArrayCollection();
  105.         $this->centrePartenaires = new ArrayCollection();
  106.         $this->utilisateurs = new ArrayCollection();
  107.     }
  108.   
  109.     public function getId(): ?int
  110.     {
  111.         return $this->id;
  112.     }
  113.     public function getCgNom(): ?string
  114.     {
  115.         return $this->cg_nom;
  116.     }
  117.     public function setCgNom(string $cg_nom): self
  118.     {
  119.         $this->cg_nom $cg_nom;
  120.         return $this;
  121.     }
  122.     public function getCgPasHoraires(): ?int
  123.     {
  124.         return $this->cg_pas_horaires;
  125.     }
  126.     public function setCgPasHoraires(int $cg_pas_horaires): self
  127.     {
  128.         $this->cg_pas_horaires $cg_pas_horaires;
  129.         return $this;
  130.     }
  131.     public function isCgActif(): ?bool
  132.     {
  133.         return $this->cg_actif;
  134.     }
  135.     public function setCgActif(bool $cg_actif): self
  136.     {
  137.         $this->cg_actif $cg_actif;
  138.         return $this;
  139.     }
  140.     public function isCgStayToDateRdv(): ?bool
  141.     {
  142.         return $this->cg_stay_to_date_rdv;
  143.     }
  144.     public function setCgStayToDateRdv(bool $cg_stay_to_date_rdv): self
  145.     {
  146.         $this->cg_stay_to_date_rdv $cg_stay_to_date_rdv;
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection<int, Ligne>
  151.      */
  152.     public function getLignes(): Collection
  153.     {
  154.         return $this->lignes;
  155.     }
  156.     public function addLigne(Ligne $ligne): self
  157.     {
  158.         if (!$this->lignes->contains($ligne)) {
  159.             $this->lignes[] = $ligne;
  160.             $ligne->setCentreGroupe($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function getLignesByTypes($types=array())
  165.     {
  166.     //    return  $this->getLignes(true)->filter(function($ligne)use ($types) {
  167.     //                 return (in_array($ligne->getCentreType()->getctDenomination(),$types) === true ) ;
  168.     //             });
  169.         return $this->getLignes(true)->filter(function($ligne) use ($types) {
  170.             $typeMatch false;
  171.             
  172.             if (in_array('VL'$types) && $ligne->isLgnVl() === true) {
  173.                 $typeMatch true;
  174.             }
  175.             if (in_array('PL'$types) && $ligne->isLgnPl() === true) {
  176.                 $typeMatch true;
  177.             }
  178.             if (in_array('CL'$types) && $ligne->isLgnCl() === true) {
  179.                 $typeMatch true;
  180.             }
  181.     
  182.             return $typeMatch;
  183.         });
  184.     }
  185.     public function removeLigne(Ligne $ligne): self
  186.     {
  187.         if ($this->lignes->removeElement($ligne)) {
  188.             // set the owning side to null (unless already changed)
  189.             if ($ligne->getCentreGroupe() === $this) {
  190.                 $ligne->setCentreGroupe(null);
  191.             }
  192.         }
  193.         return $this;
  194.     }
  195.     /**
  196.      * @return Collection<int, TypeVehicule>
  197.      */
  198.     public function getTypeVehicules(): Collection
  199.     {
  200.         return $this->typeVehicules;
  201.     }
  202.     public function addTypeVehicule(TypeVehicule $typeVehicule): self
  203.     {
  204.         if (!$this->typeVehicules->contains($typeVehicule)) {
  205.             $this->typeVehicules[] = $typeVehicule;
  206.             $typeVehicule->setCentreGroupe($this);
  207.         }
  208.         return $this;
  209.     }
  210.     public function removeTypeVehicule(TypeVehicule $typeVehicule): self
  211.     {
  212.         if ($this->typeVehicules->removeElement($typeVehicule)) {
  213.             // set the owning side to null (unless already changed)
  214.             if ($typeVehicule->getCentreGroupe() === $this) {
  215.                 $typeVehicule->setCentreGroupe(null);
  216.             }
  217.         }
  218.         return $this;
  219.     }
  220.     /**
  221.      * @return Collection<int, TypeVisite>
  222.      */
  223.     public function getTypeVisites(): Collection
  224.     {
  225.         return $this->typeVisites;
  226.     }
  227.     public function addTypeVisite(TypeVisite $typeVisite): self
  228.     {
  229.         if (!$this->typeVisites->contains($typeVisite)) {
  230.             $this->typeVisites[] = $typeVisite;
  231.             $typeVisite->setCentreGroupe($this);
  232.         }
  233.         return $this;
  234.     }
  235.     public function removeTypeVisite(TypeVisite $typeVisite): self
  236.     {
  237.         if ($this->typeVisites->removeElement($typeVisite)) {
  238.             // set the owning side to null (unless already changed)
  239.             if ($typeVisite->getCentreGroupe() === $this) {
  240.                 $typeVisite->setCentreGroupe(null);
  241.             }
  242.         }
  243.         return $this;
  244.     }
  245.     /**
  246.      * @return Collection<int, CentrePrestation>
  247.      */
  248.     public function getCentrePrestations(): Collection
  249.     {
  250.         return $this->centrePrestations;
  251.     }
  252.     public function addCentrePrestation(CentrePrestation $centrePrestation): self
  253.     {
  254.         if (!$this->centrePrestations->contains($centrePrestation)) {
  255.             $this->centrePrestations[] = $centrePrestation;
  256.             $centrePrestation->setCentreGroupe($this);
  257.         }
  258.         return $this;
  259.     }
  260.     public function removeCentrePrestation(CentrePrestation $centrePrestation): self
  261.     {
  262.         if ($this->centrePrestations->removeElement($centrePrestation)) {
  263.             // set the owning side to null (unless already changed)
  264.             if ($centrePrestation->getCentreGroupe() === $this) {
  265.                 $centrePrestation->setCentreGroupe(null);
  266.             }
  267.         }
  268.         return $this;
  269.     }
  270.     /**
  271.      * @return Collection<int, Promotion>
  272.      */
  273.     public function getPromotions(): Collection
  274.     {
  275.         return $this->promotions;
  276.     }
  277.     public function addPromotion(Promotion $promotion): self
  278.     {
  279.         if (!$this->promotions->contains($promotion)) {
  280.             $this->promotions[] = $promotion;
  281.             $promotion->setCentreGroupe($this);
  282.         }
  283.         return $this;
  284.     }
  285.     public function removePromotion(Promotion $promotion): self
  286.     {
  287.         if ($this->promotions->removeElement($promotion)) {
  288.             // set the owning side to null (unless already changed)
  289.             if ($promotion->getCentreGroupe() === $this) {
  290.                 $promotion->setCentreGroupe(null);
  291.             }
  292.         }
  293.         return $this;
  294.     }
  295.     /**
  296.      * @return Collection<int, CentreCouponPromotion>
  297.      */
  298.     public function getCentreCouponPromotions(): Collection
  299.     {
  300.         return $this->centreCouponPromotions;
  301.     }
  302.     public function addCentreCouponPromotion(CentreCouponPromotion $centreCouponPromotion): self
  303.     {
  304.         if (!$this->centreCouponPromotions->contains($centreCouponPromotion)) {
  305.             $this->centreCouponPromotions[] = $centreCouponPromotion;
  306.             $centreCouponPromotion->setCentreGroupe($this);
  307.         }
  308.         return $this;
  309.     }
  310.     public function removeCentreCouponPromotion(CentreCouponPromotion $centreCouponPromotion): self
  311.     {
  312.         if ($this->centreCouponPromotions->removeElement($centreCouponPromotion)) {
  313.             // set the owning side to null (unless already changed)
  314.             if ($centreCouponPromotion->getCentreGroupe() === $this) {
  315.                 $centreCouponPromotion->setCentreGroupe(null);
  316.             }
  317.         }
  318.         return $this;
  319.     }
  320.     public function getCgGerant(): ?Gerant
  321.     {
  322.         return $this->cg_gerant;
  323.     }
  324.     public function setCgGerant(?Gerant $cg_gerant): self
  325.     {
  326.         $this->cg_gerant $cg_gerant;
  327.         return $this;
  328.     }
  329.     public function getCentreGroupeCss(): ?CentreGroupeCss
  330.     {
  331.         return $this->centre_groupe_css;
  332.     }
  333.     public function setCentreGroupeCss(?CentreGroupeCss $centre_groupe_css): self
  334.     {
  335.         $this->centre_groupe_css $centre_groupe_css;
  336.         return $this;
  337.     }
  338.     /**
  339.      * @return Collection<int, ClientCompte>
  340.      */
  341.     public function getClientComptes(): Collection
  342.     {
  343.         return $this->clientComptes;
  344.     }
  345.     public function addClientCompte(ClientCompte $clientCompte): self
  346.     {
  347.         if (!$this->clientComptes->contains($clientCompte)) {
  348.             $this->clientComptes[] = $clientCompte;
  349.             $clientCompte->setCentreGroupe($this);
  350.         }
  351.         return $this;
  352.     }
  353.     public function removeClientCompte(ClientCompte $clientCompte): self
  354.     {
  355.         if ($this->clientComptes->removeElement($clientCompte)) {
  356.             // set the owning side to null (unless already changed)
  357.             if ($clientCompte->getCentreGroupe() === $this) {
  358.                 $clientCompte->setCentreGroupe(null);
  359.             }
  360.         }
  361.         return $this;
  362.     }
  363.     /**
  364.      * @return Collection<int, Centre>
  365.      */
  366.     public function getCentres(): Collection
  367.     {
  368.         return $this->centres;
  369.     }
  370.     public function addCentre(Centre $centre): self
  371.     {
  372.         if (!$this->centres->contains($centre)) {
  373.             $this->centres[] = $centre;
  374.             $centre->setCentreGroupe($this);
  375.         }
  376.         return $this;
  377.     }
  378.     public function removeCentre(Centre $centre): self
  379.     {
  380.         if ($this->centres->removeElement($centre)) {
  381.             // set the owning side to null (unless already changed)
  382.             if ($centre->getCentreGroupe() === $this) {
  383.                 $centre->setCentreGroupe(null);
  384.             }
  385.         }
  386.         return $this;
  387.     }
  388.     /**
  389.      * @return Collection<int, CentrePartenaire>
  390.      */
  391.     public function getCentrePartenaires(): Collection
  392.     {
  393.         return $this->centrePartenaires;
  394.     }
  395.     public function addCentrePartenaire(CentrePartenaire $centrePartenaire): self
  396.     {
  397.         if (!$this->centrePartenaires->contains($centrePartenaire)) {
  398.             $this->centrePartenaires[] = $centrePartenaire;
  399.             $centrePartenaire->setCentreGroupe($this);
  400.         }
  401.         return $this;
  402.     }
  403.     public function removeCentrePartenaire(CentrePartenaire $centrePartenaire): self
  404.     {
  405.         if ($this->centrePartenaires->removeElement($centrePartenaire)) {
  406.             // set the owning side to null (unless already changed)
  407.             if ($centrePartenaire->getCentreGroupe() === $this) {
  408.                 $centrePartenaire->setCentreGroupe(null);
  409.             }
  410.         }
  411.         return $this;
  412.     }
  413.     public function getIdOld(): ?int
  414.     {
  415.         return $this->id_old;
  416.     }
  417.     public function setIdOld(int $id_old): self
  418.     {
  419.         $this->id_old $id_old;
  420.         return $this;
  421.     }
  422.     /**
  423.      * @return Collection<int, Utilisateur>
  424.      */
  425.     public function getUtilisateurs(): Collection
  426.     {
  427.         return $this->utilisateurs;
  428.     }
  429.     public function addUtilisateur(Utilisateur $utilisateur): self
  430.     {
  431.         if (!$this->utilisateurs->contains($utilisateur)) {
  432.             $this->utilisateurs[] = $utilisateur;
  433.             $utilisateur->setCentreGroupe($this);
  434.         }
  435.         return $this;
  436.     }
  437.     public function removeUtilisateur(Utilisateur $utilisateur): self
  438.     {
  439.         if ($this->utilisateurs->removeElement($utilisateur)) {
  440.             // set the owning side to null (unless already changed)
  441.             if ($utilisateur->getCentreGroupe() === $this) {
  442.                 $utilisateur->setCentreGroupe(null);
  443.             }
  444.         }
  445.         return $this;
  446.     }
  447.     public function getCgServeur(): ?string
  448.     {
  449.         return $this->cg_serveur;
  450.     }
  451.     public function setCgServeur(?string $cg_serveur): self
  452.     {
  453.         $this->cg_serveur $cg_serveur;
  454.         return $this;
  455.     }
  456. }