src/Entity/Etablissement.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 Etablissement
  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 $definition;
  17.     #[ORM\ManyToOne(targetEntityLocalite::class, inversedBy'etablissements')]
  18.     #[ORM\JoinColumn(nullabletrue)]
  19.     private $localite;
  20.     // NOUVELLE RELATION : Direction RĂ©gionale
  21.     #[ORM\ManyToOne(targetEntityDirectionRegionale::class, inversedBy'etablissements')]
  22.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  23.     private $directionRegionale;
  24.     #[ORM\ManyToOne(targetEntityUser::class)]
  25.     #[ORM\JoinColumn(nullabletrue)]
  26.     private $user;
  27.     #[ORM\Column(type'date'nullabletrue)]
  28.     private $creation;
  29.     #[ORM\Column(type'datetime'nullabletrue)]
  30.     private $modification;
  31.     #[ORM\OneToMany(mappedBy'etablissement'targetEntityEtablissementMetier::class)]
  32.     private $etablissementMetiers;
  33.     #[ORM\OneToMany(mappedBy'etablissement'targetEntityCandidature::class)]
  34.     private $candidatures;
  35.     public function __construct()
  36.     {
  37.         $this->etablissementMetiers = new ArrayCollection();
  38.         $this->candidatures = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getNom(): ?string
  45.     {
  46.         return $this->nom;
  47.     }
  48.     public function setNom(?string $nom): self
  49.     {
  50.         $this->nom $nom;
  51.         return $this;
  52.     }
  53.     public function getDefinition(): ?string
  54.     {
  55.         return $this->definition;
  56.     }
  57.     public function setDefinition(?string $definition): self
  58.     {
  59.         $this->definition $definition;
  60.         return $this;
  61.     }
  62.     public function getLocalite(): ?Localite
  63.     {
  64.         return $this->localite;
  65.     }
  66.     public function setLocalite(?Localite $localite): self
  67.     {
  68.         $this->localite $localite;
  69.         return $this;
  70.     }
  71.     // NOUVEAUX GETTER/SETTER : Direction Regionale
  72.     public function getDirectionRegionale(): ?DirectionRegionale
  73.     {
  74.         return $this->directionRegionale;
  75.     }
  76.     public function setDirectionRegionale(?DirectionRegionale $directionRegionale): self
  77.     {
  78.         $this->directionRegionale $directionRegionale;
  79.         return $this;
  80.     }
  81.     public function getUser(): ?User
  82.     {
  83.         return $this->user;
  84.     }
  85.     public function setUser(?User $user): self
  86.     {
  87.         $this->user $user;
  88.         return $this;
  89.     }
  90.     public function getCreation(): ?\DateTimeInterface
  91.     {
  92.         return $this->creation;
  93.     }
  94.     public function setCreation(?\DateTimeInterface $creation): self
  95.     {
  96.         $this->creation $creation;
  97.         return $this;
  98.     }
  99.     public function getModification(): ?\DateTimeInterface
  100.     {
  101.         return $this->modification;
  102.     }
  103.     public function setModification(?\DateTimeInterface $modification): self
  104.     {
  105.         $this->modification $modification;
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return Collection<int, EtablissementMetier>
  110.      */
  111.     public function getEtablissementMetiers(): Collection
  112.     {
  113.         return $this->etablissementMetiers;
  114.     }
  115.     public function addEtablissementMetier(EtablissementMetier $etablissementMetier): self
  116.     {
  117.         if (!$this->etablissementMetiers->contains($etablissementMetier)) {
  118.             $this->etablissementMetiers[] = $etablissementMetier;
  119.             $etablissementMetier->setEtablissement($this);
  120.         }
  121.         return $this;
  122.     }
  123.     public function removeEtablissementMetier(EtablissementMetier $etablissementMetier): self
  124.     {
  125.         if ($this->etablissementMetiers->removeElement($etablissementMetier)) {
  126.             if ($etablissementMetier->getEtablissement() === $this) {
  127.                 $etablissementMetier->setEtablissement(null);
  128.             }
  129.         }
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection<int, Candidature>
  134.      */
  135.     public function getCandidatures(): Collection
  136.     {
  137.         return $this->candidatures;
  138.     }
  139.     public function addCandidature(Candidature $candidature): self
  140.     {
  141.         if (!$this->candidatures->contains($candidature)) {
  142.             $this->candidatures[] = $candidature;
  143.             $candidature->setEtablissement($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeCandidature(Candidature $candidature): self
  148.     {
  149.         if ($this->candidatures->removeElement($candidature)) {
  150.             if ($candidature->getEtablissement() === $this) {
  151.                 $candidature->setEtablissement(null);
  152.             }
  153.         }
  154.         return $this;
  155.     }
  156.     public function __toString(): string
  157.     {
  158.         return $this->definition ' (' $this->nom ')' ?? '';
  159.     }
  160. }