src/Entity/Pays.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PaysRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PaysRepository::class)
  9.  */
  10. class Pays
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $nom;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=Restriction::class, mappedBy="pays", orphanRemoval=true)
  24.      */
  25.     private $restrictions;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Zone::class, inversedBy="pays")
  28.      */
  29.     private $zone;
  30.     public function __construct()
  31.     {
  32.         $this->restrictions = new ArrayCollection();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getNom(): ?string
  39.     {
  40.         return $this->nom;
  41.     }
  42.     public function setNom(string $nom): self
  43.     {
  44.         $this->nom $nom;
  45.         return $this;
  46.     }
  47.     /**
  48.      * @return Collection<int, Restriction>
  49.      */
  50.     public function getRestrictions(): Collection
  51.     {
  52.         return $this->restrictions;
  53.     }
  54.     public function addRestriction(Restriction $restriction): self
  55.     {
  56.         if (!$this->restrictions->contains($restriction)) {
  57.             $this->restrictions[] = $restriction;
  58.             $restriction->setPays($this);
  59.         }
  60.         return $this;
  61.     }
  62.     public function removeRestriction(Restriction $restriction): self
  63.     {
  64.         if ($this->restrictions->removeElement($restriction)) {
  65.             // set the owning side to null (unless already changed)
  66.             if ($restriction->getPays() === $this) {
  67.                 $restriction->setPays(null);
  68.             }
  69.         }
  70.         return $this;
  71.     }
  72.     public function getZone(): ?Zone
  73.     {
  74.         return $this->zone;
  75.     }
  76.     public function setZone(?Zone $zone): self
  77.     {
  78.         $this->zone $zone;
  79.         return $this;
  80.     }
  81. }