<?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, nullable=true)
*/
private $Libelle;
/**
* @ORM\OneToMany(targetEntity=Departements::class, mappedBy="Pays")
*/
private $departements;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="Pays")
*/
private $users;
public function __construct()
{
$this->departements = new ArrayCollection();
$this->users = 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;
}
/**
* @return Collection<int, Departements>
*/
public function getDepartements(): Collection
{
return $this->departements;
}
public function addDepartement(Departements $departement): self
{
if (!$this->departements->contains($departement)) {
$this->departements[] = $departement;
$departement->setPays($this);
}
return $this;
}
public function removeDepartement(Departements $departement): self
{
if ($this->departements->removeElement($departement)) {
// set the owning side to null (unless already changed)
if ($departement->getPays() === $this) {
$departement->setPays(null);
}
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setPays($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getPays() === $this) {
$user->setPays(null);
}
}
return $this;
}
}