src\Entity\Zone.php line 10

Open in your IDE?
  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(repositoryClass\App\Repository\ZoneRepository::class)]
  7. class Zone
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'string'length255)]
  14.     private $codezone;
  15.     #[ORM\Column(type'string'length255)]
  16.     private $libzone;
  17.     #[ORM\OneToMany(targetEntity\App\Entity\Pays::class, mappedBy'zone')]
  18.     private $pays;
  19.     public function __construct()
  20.     {
  21.         $this->pays = new ArrayCollection();
  22.     }
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getCodezone(): ?string
  28.     {
  29.         return $this->codezone;
  30.     }
  31.     public function setCodezone(string $codezone): self
  32.     {
  33.         $this->codezone $codezone;
  34.         return $this;
  35.     }
  36.     public function getLibzone(): ?string
  37.     {
  38.         return $this->libzone;
  39.     }
  40.     public function setLibzone(string $libzone): self
  41.     {
  42.         $this->libzone $libzone;
  43.         return $this;
  44.     }
  45.     /**
  46.      * @return Collection|Pays[]
  47.      */
  48.     public function getPays(): Collection
  49.     {
  50.         return $this->pays;
  51.     }
  52.     public function addPay(Pays $pay): self
  53.     {
  54.         if (!$this->pays->contains($pay)) {
  55.             $this->pays[] = $pay;
  56.             $pay->setZone($this);
  57.         }
  58.         return $this;
  59.     }
  60.     public function removePay(Pays $pay): self
  61.     {
  62.         if ($this->pays->contains($pay)) {
  63.             $this->pays->removeElement($pay);
  64.             // set the owning side to null (unless already changed)
  65.             if ($pay->getZone() === $this) {
  66.                 $pay->setZone(null);
  67.             }
  68.         }
  69.         return $this;
  70.     }
  71. }