<?php
namespace App\Entity;
use App\Repository\PaysRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PaysRepository::class)
*/
class Pays
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $nom;
/**
* @ORM\OneToMany(targetEntity=Restriction::class, mappedBy="pays", orphanRemoval=true)
*/
private $restrictions;
/**
* @ORM\ManyToOne(targetEntity=Zone::class, inversedBy="pays")
*/
private $zone;
public function __construct()
{
$this->restrictions = new ArrayCollection();
}
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;
}
/**
* @return Collection<int, Restriction>
*/
public function getRestrictions(): Collection
{
return $this->restrictions;
}
public function addRestriction(Restriction $restriction): self
{
if (!$this->restrictions->contains($restriction)) {
$this->restrictions[] = $restriction;
$restriction->setPays($this);
}
return $this;
}
public function removeRestriction(Restriction $restriction): self
{
if ($this->restrictions->removeElement($restriction)) {
// set the owning side to null (unless already changed)
if ($restriction->getPays() === $this) {
$restriction->setPays(null);
}
}
return $this;
}
public function getZone(): ?Zone
{
return $this->zone;
}
public function setZone(?Zone $zone): self
{
$this->zone = $zone;
return $this;
}
}