<?php
namespace App\Entity;
use App\Repository\DepartementsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DepartementsRepository::class)
*/
class Departements
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Libelle;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $LibelleSimple;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Code;
/**
* @ORM\ManyToOne(targetEntity=Pays::class, inversedBy="departements")
*/
private $Pays;
/**
* @ORM\OneToMany(targetEntity=Villes::class, mappedBy="Departements")
*/
private $villes;
public function __construct()
{
$this->villes = 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;
}
public function getLibelleSimple(): ?string
{
return $this->LibelleSimple;
}
public function setLibelleSimple(?string $LibelleSimple): self
{
$this->LibelleSimple = $LibelleSimple;
return $this;
}
public function getCode(): ?string
{
return $this->Code;
}
public function setCode(?string $Code): self
{
$this->Code = $Code;
return $this;
}
public function getPays(): ?Pays
{
return $this->Pays;
}
public function setPays(?Pays $Pays): self
{
$this->Pays = $Pays;
return $this;
}
/**
* @return Collection<int, Villes>
*/
public function getVilles(): Collection
{
return $this->villes;
}
public function addVille(Villes $ville): self
{
if (!$this->villes->contains($ville)) {
$this->villes[] = $ville;
$ville->setDepartements($this);
}
return $this;
}
public function removeVille(Villes $ville): self
{
if ($this->villes->removeElement($ville)) {
// set the owning side to null (unless already changed)
if ($ville->getDepartements() === $this) {
$ville->setDepartements(null);
}
}
return $this;
}
}