src/Entity/Localite.php line 11
<?phpnamespace App\Entity;use DateTimeInterface;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity()]class Localite{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]private $id;#[ORM\Column(type: 'string', length: 100)]private $nom;#[ORM\Column(type: 'string', length: 20)]private $type; // 'region', 'departement', 'commune', 'ville', 'sous-prefecture', 'village'#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'enfants')]#[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'CASCADE')]private $parent;#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]private $enfants;// NOUVEAU : Relation avec DirectionRegionale#[ORM\ManyToOne(targetEntity: DirectionRegionale::class, inversedBy: 'localites')]#[ORM\JoinColumn(nullable: true)]private $directionRegionale;// NOUVEAU : Relation avec Etablissement#[ORM\OneToMany(mappedBy: 'localite', targetEntity: Etablissement::class)]private $etablissements;#[ORM\ManyToOne(targetEntity: User::class)]#[ORM\JoinColumn(nullable: true)]private $user;#[ORM\Column(type: 'datetime', nullable: true)]private $creation;#[ORM\Column(type: 'datetime', nullable: true)]private $modification;public function __construct(){$this->enfants = new ArrayCollection();$this->etablissements = new ArrayCollection();}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}public function getCreation(): ?\DateTimeInterface{return $this->creation;}public function setCreation(?\DateTimeInterface $creation): self{$this->creation = $creation;return $this;}public function getModification(): ?\DateTimeInterface{return $this->modification;}public function setModification(?\DateTimeInterface $modification): self{$this->modification = $modification;return $this;}public function getId(): ?int{return $this->id;}public function getNom(): ?string{return $this->nom;}public function setNom(?string $nom): self{$this->nom = $nom;return $this;}public function getType(): ?string{return $this->type;}public function setType(?string $type): self{$this->type = $type;return $this;}public function getParent(): ?self{return $this->parent;}public function setParent(?self $parent): self{$this->parent = $parent;return $this;}public function getEnfants(): Collection{return $this->enfants;}public function addEnfant(self $enfant): self{if (!$this->enfants->contains($enfant)) {$this->enfants[] = $enfant;$enfant->setParent($this);}return $this;}public function removeEnfant(self $enfant): self{if ($this->enfants->removeElement($enfant)) {if ($enfant->getParent() === $this) {$enfant->setParent(null);}}return $this;}// NOUVELLES MÉTHODES pour DirectionRegionalepublic function getDirectionRegionale(): ?DirectionRegionale{return $this->directionRegionale;}public function setDirectionRegionale(?DirectionRegionale $directionRegionale): self{$this->directionRegionale = $directionRegionale;return $this;}// NOUVELLES MÉTHODES pour Etablissement/*** @return Collection<int, Etablissement>*/public function getEtablissements(): Collection{return $this->etablissements;}public function addEtablissement(Etablissement $etablissement): self{if (!$this->etablissements->contains($etablissement)) {$this->etablissements[] = $etablissement;$etablissement->setLocalite($this);}return $this;}public function removeEtablissement(Etablissement $etablissement): self{if ($this->etablissements->removeElement($etablissement)) {if ($etablissement->getLocalite() === $this) {$etablissement->setLocalite(null);}}return $this;}public function __toString(): string{return $this->nom ?? '';}}