<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Controller\AdminController;
use Doctrine\ORM\EntityManagerInterface;
use App\Repository\CentreGroupeRepository;
use Doctrine\Common\Collections\Collection;
use Symfony\Contracts\Cache\CacheInterface;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity(repositoryClass=CentreGroupeRepository::class)
*/
class CentreGroupe
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=50)
*/
private $cg_nom;
/**
* @ORM\Column(type="integer")
*/
private $cg_pas_horaires;
/**
* @ORM\Column(type="boolean")
*/
private $cg_actif;
/**
* @ORM\Column(type="boolean")
*/
private $cg_stay_to_date_rdv;
/**
* @ORM\OneToMany(targetEntity=Ligne::class, mappedBy="centre_groupe")
*/
private $lignes;
/**
* @ORM\OneToMany(targetEntity=TypeVehicule::class, mappedBy="centre_groupe")
*/
private $typeVehicules;
/**
* @ORM\OneToMany(targetEntity=TypeVisite::class, mappedBy="centre_groupe")
*/
private $typeVisites;
/**
* @ORM\OneToMany(targetEntity=CentrePrestation::class, mappedBy="centre_groupe", fetch="EAGER")
*/
private $centrePrestations;
/**
* @ORM\OneToMany(targetEntity=Promotion::class, mappedBy="centre_groupe")
*/
private $promotions;
/**
* @ORM\OneToMany(targetEntity=CentreCouponPromotion::class, mappedBy="centre_groupe", orphanRemoval=true)
*/
private $centreCouponPromotions;
/**
* @ORM\ManyToOne(targetEntity=Gerant::class, inversedBy="centreGroupes")
*/
private $cg_gerant;
/**
* @ORM\ManyToOne(targetEntity=CentreGroupeCss::class, inversedBy="centreGroupes", fetch="EAGER")
*/
private $centre_groupe_css;
/**
* @ORM\OneToMany(targetEntity=ClientCompte::class, mappedBy="centre_groupe", orphanRemoval=true)
*/
private $clientComptes;
/**
* @ORM\OneToMany(targetEntity=Centre::class, mappedBy="centre_groupe", orphanRemoval=true, fetch="EAGER")
*/
private $centres;
/**
* @ORM\OneToMany(targetEntity=CentrePartenaire::class, mappedBy="centre_groupe", orphanRemoval=true)
*/
private $centrePartenaires;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $id_old;
/**
* @ORM\OneToMany(targetEntity=Utilisateur::class, mappedBy="CentreGroupe", orphanRemoval=true)
* @ORM\JoinColumn(nullable=true)
*/
private $utilisateurs;
protected $em;
/**
* @ORM\Column(type="string", length=30, nullable=true)
*/
private $cg_serveur;
public function __construct()
{
$this->lignes = new ArrayCollection();
$this->typeVehicules = new ArrayCollection();
$this->typeVisites = new ArrayCollection();
$this->centrePrestations = new ArrayCollection();
$this->promotions = new ArrayCollection();
$this->centreCouponPromotions = new ArrayCollection();
$this->clientComptes = new ArrayCollection();
$this->centres = new ArrayCollection();
$this->centrePartenaires = new ArrayCollection();
$this->utilisateurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCgNom(): ?string
{
return $this->cg_nom;
}
public function setCgNom(string $cg_nom): self
{
$this->cg_nom = $cg_nom;
return $this;
}
public function getCgPasHoraires(): ?int
{
return $this->cg_pas_horaires;
}
public function setCgPasHoraires(int $cg_pas_horaires): self
{
$this->cg_pas_horaires = $cg_pas_horaires;
return $this;
}
public function isCgActif(): ?bool
{
return $this->cg_actif;
}
public function setCgActif(bool $cg_actif): self
{
$this->cg_actif = $cg_actif;
return $this;
}
public function isCgStayToDateRdv(): ?bool
{
return $this->cg_stay_to_date_rdv;
}
public function setCgStayToDateRdv(bool $cg_stay_to_date_rdv): self
{
$this->cg_stay_to_date_rdv = $cg_stay_to_date_rdv;
return $this;
}
/**
* @return Collection<int, Ligne>
*/
public function getLignes(): Collection
{
return $this->lignes;
}
public function addLigne(Ligne $ligne): self
{
if (!$this->lignes->contains($ligne)) {
$this->lignes[] = $ligne;
$ligne->setCentreGroupe($this);
}
return $this;
}
public function getLignesByTypes($types=array())
{
// return $this->getLignes(true)->filter(function($ligne)use ($types) {
// return (in_array($ligne->getCentreType()->getctDenomination(),$types) === true ) ;
// });
return $this->getLignes(true)->filter(function($ligne) use ($types) {
$typeMatch = false;
if (in_array('VL', $types) && $ligne->isLgnVl() === true) {
$typeMatch = true;
}
if (in_array('PL', $types) && $ligne->isLgnPl() === true) {
$typeMatch = true;
}
if (in_array('CL', $types) && $ligne->isLgnCl() === true) {
$typeMatch = true;
}
return $typeMatch;
});
}
public function removeLigne(Ligne $ligne): self
{
if ($this->lignes->removeElement($ligne)) {
// set the owning side to null (unless already changed)
if ($ligne->getCentreGroupe() === $this) {
$ligne->setCentreGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, TypeVehicule>
*/
public function getTypeVehicules(): Collection
{
return $this->typeVehicules;
}
public function addTypeVehicule(TypeVehicule $typeVehicule): self
{
if (!$this->typeVehicules->contains($typeVehicule)) {
$this->typeVehicules[] = $typeVehicule;
$typeVehicule->setCentreGroupe($this);
}
return $this;
}
public function removeTypeVehicule(TypeVehicule $typeVehicule): self
{
if ($this->typeVehicules->removeElement($typeVehicule)) {
// set the owning side to null (unless already changed)
if ($typeVehicule->getCentreGroupe() === $this) {
$typeVehicule->setCentreGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, TypeVisite>
*/
public function getTypeVisites(): Collection
{
return $this->typeVisites;
}
public function addTypeVisite(TypeVisite $typeVisite): self
{
if (!$this->typeVisites->contains($typeVisite)) {
$this->typeVisites[] = $typeVisite;
$typeVisite->setCentreGroupe($this);
}
return $this;
}
public function removeTypeVisite(TypeVisite $typeVisite): self
{
if ($this->typeVisites->removeElement($typeVisite)) {
// set the owning side to null (unless already changed)
if ($typeVisite->getCentreGroupe() === $this) {
$typeVisite->setCentreGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, CentrePrestation>
*/
public function getCentrePrestations(): Collection
{
return $this->centrePrestations;
}
public function addCentrePrestation(CentrePrestation $centrePrestation): self
{
if (!$this->centrePrestations->contains($centrePrestation)) {
$this->centrePrestations[] = $centrePrestation;
$centrePrestation->setCentreGroupe($this);
}
return $this;
}
public function removeCentrePrestation(CentrePrestation $centrePrestation): self
{
if ($this->centrePrestations->removeElement($centrePrestation)) {
// set the owning side to null (unless already changed)
if ($centrePrestation->getCentreGroupe() === $this) {
$centrePrestation->setCentreGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, Promotion>
*/
public function getPromotions(): Collection
{
return $this->promotions;
}
public function addPromotion(Promotion $promotion): self
{
if (!$this->promotions->contains($promotion)) {
$this->promotions[] = $promotion;
$promotion->setCentreGroupe($this);
}
return $this;
}
public function removePromotion(Promotion $promotion): self
{
if ($this->promotions->removeElement($promotion)) {
// set the owning side to null (unless already changed)
if ($promotion->getCentreGroupe() === $this) {
$promotion->setCentreGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, CentreCouponPromotion>
*/
public function getCentreCouponPromotions(): Collection
{
return $this->centreCouponPromotions;
}
public function addCentreCouponPromotion(CentreCouponPromotion $centreCouponPromotion): self
{
if (!$this->centreCouponPromotions->contains($centreCouponPromotion)) {
$this->centreCouponPromotions[] = $centreCouponPromotion;
$centreCouponPromotion->setCentreGroupe($this);
}
return $this;
}
public function removeCentreCouponPromotion(CentreCouponPromotion $centreCouponPromotion): self
{
if ($this->centreCouponPromotions->removeElement($centreCouponPromotion)) {
// set the owning side to null (unless already changed)
if ($centreCouponPromotion->getCentreGroupe() === $this) {
$centreCouponPromotion->setCentreGroupe(null);
}
}
return $this;
}
public function getCgGerant(): ?Gerant
{
return $this->cg_gerant;
}
public function setCgGerant(?Gerant $cg_gerant): self
{
$this->cg_gerant = $cg_gerant;
return $this;
}
public function getCentreGroupeCss(): ?CentreGroupeCss
{
return $this->centre_groupe_css;
}
public function setCentreGroupeCss(?CentreGroupeCss $centre_groupe_css): self
{
$this->centre_groupe_css = $centre_groupe_css;
return $this;
}
/**
* @return Collection<int, ClientCompte>
*/
public function getClientComptes(): Collection
{
return $this->clientComptes;
}
public function addClientCompte(ClientCompte $clientCompte): self
{
if (!$this->clientComptes->contains($clientCompte)) {
$this->clientComptes[] = $clientCompte;
$clientCompte->setCentreGroupe($this);
}
return $this;
}
public function removeClientCompte(ClientCompte $clientCompte): self
{
if ($this->clientComptes->removeElement($clientCompte)) {
// set the owning side to null (unless already changed)
if ($clientCompte->getCentreGroupe() === $this) {
$clientCompte->setCentreGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, Centre>
*/
public function getCentres(): Collection
{
return $this->centres;
}
public function addCentre(Centre $centre): self
{
if (!$this->centres->contains($centre)) {
$this->centres[] = $centre;
$centre->setCentreGroupe($this);
}
return $this;
}
public function removeCentre(Centre $centre): self
{
if ($this->centres->removeElement($centre)) {
// set the owning side to null (unless already changed)
if ($centre->getCentreGroupe() === $this) {
$centre->setCentreGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, CentrePartenaire>
*/
public function getCentrePartenaires(): Collection
{
return $this->centrePartenaires;
}
public function addCentrePartenaire(CentrePartenaire $centrePartenaire): self
{
if (!$this->centrePartenaires->contains($centrePartenaire)) {
$this->centrePartenaires[] = $centrePartenaire;
$centrePartenaire->setCentreGroupe($this);
}
return $this;
}
public function removeCentrePartenaire(CentrePartenaire $centrePartenaire): self
{
if ($this->centrePartenaires->removeElement($centrePartenaire)) {
// set the owning side to null (unless already changed)
if ($centrePartenaire->getCentreGroupe() === $this) {
$centrePartenaire->setCentreGroupe(null);
}
}
return $this;
}
public function getIdOld(): ?int
{
return $this->id_old;
}
public function setIdOld(int $id_old): self
{
$this->id_old = $id_old;
return $this;
}
/**
* @return Collection<int, Utilisateur>
*/
public function getUtilisateurs(): Collection
{
return $this->utilisateurs;
}
public function addUtilisateur(Utilisateur $utilisateur): self
{
if (!$this->utilisateurs->contains($utilisateur)) {
$this->utilisateurs[] = $utilisateur;
$utilisateur->setCentreGroupe($this);
}
return $this;
}
public function removeUtilisateur(Utilisateur $utilisateur): self
{
if ($this->utilisateurs->removeElement($utilisateur)) {
// set the owning side to null (unless already changed)
if ($utilisateur->getCentreGroupe() === $this) {
$utilisateur->setCentreGroupe(null);
}
}
return $this;
}
public function getCgServeur(): ?string
{
return $this->cg_serveur;
}
public function setCgServeur(?string $cg_serveur): self
{
$this->cg_serveur = $cg_serveur;
return $this;
}
}