<?php
namespace App\Entity;
use App\Entity\CentreGroupe;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\CentreRepository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity(repositoryClass=CentreRepository::class)
*/
class Centre
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $ctr_nom;
/**
* @ORM\Column(type="string", length=15)
*/
private $ctr_telephone;
/**
* @ORM\Column(type="string", length=255)
*/
private $ctr_email;
/**
* @ORM\Column(type="string", length=15, nullable=true)
*/
private $ctr_fax;
/**
* @ORM\Column(type="string", length=8)
*/
private $ctr_agrement;
/**
* @ORM\OneToMany(targetEntity=SmsRelance::class, mappedBy="centre")
*/
private $smsRelances;
/**
* @ORM\OneToMany(targetEntity=Sms::class, mappedBy="centre")
*/
private $sms;
/**
* @ORM\OneToOne(targetEntity=Adresse::class, cascade={"persist", "remove"}, fetch="EAGER")
* @ORM\JoinColumn(nullable=false)
*/
private $ctr_adresse;
/**
* @ORM\ManyToOne(targetEntity=CentreGroupe::class, inversedBy="centres")
* @ORM\JoinColumn(nullable=false)
*/
private $centre_groupe;
/**
* @ORM\ManyToOne(targetEntity=CentreType::class, inversedBy="centres", fetch="EAGER")
* @ORM\JoinColumn(nullable=false)
*/
private $centre_type;
/**
* @ORM\OneToOne(targetEntity=ParametreCentre::class, inversedBy="centre", cascade={"persist", "remove"}, fetch="EAGER")
* @ORM\JoinColumn(nullable=false)
*/
private $ctr_parametre_centre;
/**
* @ORM\OneToOne(targetEntity=ParametreCentreAdmin::class, inversedBy="centre", cascade={"persist", "remove"}, fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $ctr_parametre_centre_admin;
/**
* @ORM\OneToMany(targetEntity=CentreHoraire::class, mappedBy="centre", orphanRemoval=true, fetch="EAGER")
*/
private $centreHoraires;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $id_old;
protected $em;
public function __construct()
{
$this->smsRelances = new ArrayCollection();
$this->sms = new ArrayCollection();
$this->centreHoraires = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCtrNom(): ?string
{
return $this->ctr_nom;
}
public function setCtrNom(string $ctr_nom): self
{
$this->ctr_nom = $ctr_nom;
return $this;
}
public function getCtrTelephone(): ?string
{
return $this->ctr_telephone;
}
public function setCtrTelephone(string $ctr_telephone): self
{
$this->ctr_telephone = preg_replace('/\D/', '', $ctr_telephone);
return $this;
}
public function getCtrEmail(): ?string
{
return $this->ctr_email;
}
public function setCtrEmail(string $ctr_email): self
{
$this->ctr_email = $ctr_email;
return $this;
}
public function getCtrFax(): ?string
{
return $this->ctr_fax;
}
public function setCtrFax(?string $ctr_fax): self
{
$this->ctr_fax = $ctr_fax;
return $this;
}
public function getCtrAgrement(): ?string
{
return $this->ctr_agrement;
}
public function setCtrAgrement(string $ctr_agrement): self
{
$this->ctr_agrement = $ctr_agrement;
return $this;
}
/**
* @return Collection<int, SmsRelance>
*/
public function getSmsRelances(): Collection
{
return $this->smsRelances;
}
public function addSmsRelance(SmsRelance $smsRelance): self
{
if (!$this->smsRelances->contains($smsRelance)) {
$this->smsRelances[] = $smsRelance;
$smsRelance->setCentre($this);
}
return $this;
}
public function removeSmsRelance(SmsRelance $smsRelance): self
{
if ($this->smsRelances->removeElement($smsRelance)) {
// set the owning side to null (unless already changed)
if ($smsRelance->getCentre() === $this) {
$smsRelance->setCentre(null);
}
}
return $this;
}
/**
* @return Collection<int, Sms>
*/
public function getSms(): Collection
{
return $this->sms;
}
public function addSms(Sms $sms): self
{
if (!$this->sms->contains($sms)) {
$this->sms[] = $sms;
$sms->setCentre($this);
}
return $this;
}
public function removeSms(Sms $sms): self
{
if ($this->sms->removeElement($sms)) {
// set the owning side to null (unless already changed)
if ($sms->getCentre() === $this) {
$sms->setCentre(null);
}
}
return $this;
}
public function getCtrAdresse(): ?Adresse
{
return $this->ctr_adresse;
}
public function setCtrAdresse(Adresse $ctr_adresse): self
{
$this->ctr_adresse = $ctr_adresse;
return $this;
}
public function getCentreGroupe(): ?CentreGroupe
{
return $this->centre_groupe;
}
public function setCentreGroupe(?CentreGroupe $ctr_centre_groupe): self
{
$this->centre_groupe = $ctr_centre_groupe;
return $this;
}
public function getCentreType(): ?CentreType
{
return $this->centre_type;
}
public function setCentreType(?CentreType $centre_type): self
{
$this->centre_type = $centre_type;
return $this;
}
public function getCtrParametreCentre(): ?ParametreCentre
{
return $this->ctr_parametre_centre;
}
public function setCtrParametreCentre(ParametreCentre $ctr_parametre_centre): self
{
$this->ctr_parametre_centre = $ctr_parametre_centre;
return $this;
}
public function getCtrParametreCentreAdmin(): ?ParametreCentreAdmin
{
return $this->ctr_parametre_centre_admin;
}
public function setCtrParametreCentreAdmin(ParametreCentreAdmin $ctr_parametre_centre_admin): self
{
$this->ctr_parametre_centre_admin = $ctr_parametre_centre_admin;
return $this;
}
/**
* @return Collection<int, CentreHoraire>
*/
public function getCentreHoraires(): Collection
{
return $this->centreHoraires;
}
public function addCentreHoraire(CentreHoraire $centreHoraire): self
{
if (!$this->centreHoraires->contains($centreHoraire)) {
$this->centreHoraires[] = $centreHoraire;
$centreHoraire->setCentre($this);
}
return $this;
}
public function removeCentreHoraire(CentreHoraire $centreHoraire): self
{
if ($this->centreHoraires->removeElement($centreHoraire)) {
// set the owning side to null (unless already changed)
if ($centreHoraire->getCentre() === $this) {
$centreHoraire->setCentre(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;
}
}