src/Entity/Gouvernorat.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\GouvernoratRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassGouvernoratRepository::class)]
  8. class Gouvernorat
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $libelle;
  16.     #[ORM\OneToMany(mappedBy'gouvernorat'targetEntityAdresse::class)]
  17.     private $adresses;
  18.     #[ORM\OneToMany(mappedBy'gouvernorat'targetEntityDelegation::class)]
  19.     private Collection $delegations;
  20.     public function __construct()
  21.     {
  22.         $this->delegations = new ArrayCollection();
  23.         $this->adresses = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getLibelle(): ?string
  30.     {
  31.         return $this->libelle;
  32.     }
  33.     public function setLibelle(string $libelle): self
  34.     {
  35.         $this->libelle $libelle;
  36.         return $this;
  37.     }
  38.     public function __toString()
  39.     {
  40.         return (string) $this->libelle;
  41.     }
  42.     /**
  43.      * @return Collection<int, Adresse>
  44.      */
  45.     public function getAdresses(): Collection
  46.     {
  47.         return $this->adresses;
  48.     }
  49.     public function addAdress(Adresse $adress): self
  50.     {
  51.         if (!$this->adresses->contains($adress)) {
  52.             $this->adresses->add($adress);
  53.             $adress->setGouvernorat($this);
  54.         }
  55.         return $this;
  56.     }
  57.     /**
  58.      * @return Collection<int, Delegation>
  59.      */
  60.     public function getDelegations(): Collection
  61.     {
  62.         return $this->delegations;
  63.     }
  64.     public function addDelegation(Delegation $delegation): self
  65.     {
  66.         if (!$this->delegations->contains($delegation)) {
  67.             $this->delegations->add($delegation);
  68.             $delegation->setGouvernorat($this);
  69.         }
  70.         return $this;
  71.     }
  72.     public function removeAdress(Adresse $adress): self
  73.     {
  74.         if ($this->adresses->removeElement($adress)) {
  75.             // set the owning side to null (unless already changed)
  76.             if ($adress->getGouvernorat() === $this) {
  77.                 $adress->setGouvernorat(null);
  78.             }
  79.         }
  80.         return $this;
  81.     }
  82.     public function removeDelegation(Delegation $delegation): self
  83.     {
  84.         if ($this->delegations->removeElement($delegation)) {
  85.             // set the owning side to null (unless already changed)
  86.             if ($delegation->getGouvernorat() === $this) {
  87.                 $delegation->setGouvernorat(null);
  88.             }
  89.         }
  90.         return $this;
  91.     }
  92. }