<?phpnamespace App\Entity;use App\Repository\GouvernoratRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: GouvernoratRepository::class)]class Gouvernorat{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'string', length: 255)] private $libelle; #[ORM\OneToMany(mappedBy: 'gouvernorat', targetEntity: Adresse::class)] private $adresses; #[ORM\OneToMany(mappedBy: 'gouvernorat', targetEntity: Delegation::class)] private Collection $delegations; public function __construct() { $this->delegations = new ArrayCollection(); $this->adresses = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getLibelle(): ?string { return $this->libelle; } public function setLibelle(string $libelle): self { $this->libelle = $libelle; return $this; } public function __toString() { return (string) $this->libelle; } /** * @return Collection<int, Adresse> */ public function getAdresses(): Collection { return $this->adresses; } public function addAdress(Adresse $adress): self { if (!$this->adresses->contains($adress)) { $this->adresses->add($adress); $adress->setGouvernorat($this); } return $this; } /** * @return Collection<int, Delegation> */ public function getDelegations(): Collection { return $this->delegations; } public function addDelegation(Delegation $delegation): self { if (!$this->delegations->contains($delegation)) { $this->delegations->add($delegation); $delegation->setGouvernorat($this); } return $this; } public function removeAdress(Adresse $adress): self { if ($this->adresses->removeElement($adress)) { // set the owning side to null (unless already changed) if ($adress->getGouvernorat() === $this) { $adress->setGouvernorat(null); } } return $this; } public function removeDelegation(Delegation $delegation): self { if ($this->delegations->removeElement($delegation)) { // set the owning side to null (unless already changed) if ($delegation->getGouvernorat() === $this) { $delegation->setGouvernorat(null); } } return $this; }}