src/Entity/DirectionRegionale.php line 10

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity()]
  7. class DirectionRegionale
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'string'length255)]
  14.     private $nom;
  15.     #[ORM\Column(type'string'length255nullabletrue)]
  16.     private $chefLieu;
  17.     #[ORM\ManyToOne(targetEntityUser::class)]
  18.     #[ORM\JoinColumn(nullabletrue)]
  19.     private $user;
  20.     #[ORM\Column(type'date'nullabletrue)]
  21.     private $creation;
  22.     #[ORM\Column(type'datetime'nullabletrue)]
  23.     private $modification;
  24.     #[ORM\OneToMany(mappedBy'directionRegionale'targetEntityEtablissement::class)]
  25.     private $etablissements;
  26.     #[ORM\OneToMany(mappedBy'directionRegionale'targetEntityLocalite::class)]
  27.     private $localites;
  28.     public function __construct()
  29.     {
  30.         $this->etablissements = new ArrayCollection();
  31.         $this->localites = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getNom(): ?string
  38.     {
  39.         return $this->nom;
  40.     }
  41.     public function setNom(string $nom): self
  42.     {
  43.         $this->nom $nom;
  44.         return $this;
  45.     }
  46.     public function getChefLieu(): ?string
  47.     {
  48.         return $this->chefLieu;
  49.     }
  50.     public function setChefLieu(?string $chefLieu): self
  51.     {
  52.         $this->chefLieu $chefLieu;
  53.         return $this;
  54.     }
  55.     public function getUser(): ?User
  56.     {
  57.         return $this->user;
  58.     }
  59.     public function setUser(?User $user): self
  60.     {
  61.         $this->user $user;
  62.         return $this;
  63.     }
  64.     public function getCreation(): ?\DateTimeInterface
  65.     {
  66.         return $this->creation;
  67.     }
  68.     public function setCreation(?\DateTimeInterface $creation): self
  69.     {
  70.         $this->creation $creation;
  71.         return $this;
  72.     }
  73.     public function getModification(): ?\DateTimeInterface
  74.     {
  75.         return $this->modification;
  76.     }
  77.     public function setModification(?\DateTimeInterface $modification): self
  78.     {
  79.         $this->modification $modification;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, Etablissement>
  84.      */
  85.     public function getEtablissements(): Collection
  86.     {
  87.         return $this->etablissements;
  88.     }
  89.     public function addEtablissement(Etablissement $etablissement): self
  90.     {
  91.         if (!$this->etablissements->contains($etablissement)) {
  92.             $this->etablissements[] = $etablissement;
  93.             $etablissement->setDirectionRegionale($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeEtablissement(Etablissement $etablissement): self
  98.     {
  99.         if ($this->etablissements->removeElement($etablissement)) {
  100.             if ($etablissement->getDirectionRegionale() === $this) {
  101.                 $etablissement->setDirectionRegionale(null);
  102.             }
  103.         }
  104.         return $this;
  105.     }
  106.     /**
  107.      * @return Collection<int, Localite>
  108.      */
  109.     public function getLocalites(): Collection
  110.     {
  111.         return $this->localites;
  112.     }
  113.     public function addLocalite(Localite $localite): self
  114.     {
  115.         if (!$this->localites->contains($localite)) {
  116.             $this->localites[] = $localite;
  117.             $localite->setDirectionRegionale($this);
  118.         }
  119.         return $this;
  120.     }
  121.     public function removeLocalite(Localite $localite): self
  122.     {
  123.         if ($this->localites->removeElement($localite)) {
  124.             if ($localite->getDirectionRegionale() === $this) {
  125.                 $localite->setDirectionRegionale(null);
  126.             }
  127.         }
  128.         return $this;
  129.     }
  130.     public function __toString(): string
  131.     {
  132.         return $this->nom ?? '';
  133.     }
  134. }