<?php
namespace App\Entity;
use App\Repository\VillesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=VillesRepository::class)
*/
class Villes
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $etat;
/**
* @ORM\ManyToOne(targetEntity=Pays::class, inversedBy="villes")
* @ORM\JoinColumn(nullable=false)
*/
private $pays;
/**
* @ORM\OneToMany(targetEntity=Hotel::class, mappedBy="villes", orphanRemoval=true)
*/
private $hotels;
/**
* @ORM\OneToMany(targetEntity=Coordonnescircuit::class, mappedBy="ville", orphanRemoval=true)
*/
private $coordonnescircuits;
public function __construct()
{
$this->hotels = new ArrayCollection();
$this->coordonnescircuits = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function isEtat(): ?bool
{
return $this->etat;
}
public function setEtat(?bool $etat): self
{
$this->etat = $etat;
return $this;
}
public function getPays(): ?Pays
{
return $this->pays;
}
public function setPays(?Pays $pays): self
{
$this->pays = $pays;
return $this;
}
/**
* @return Collection<int, Hotel>
*/
public function getHotels(): Collection
{
return $this->hotels;
}
public function addHotel(Hotel $hotel): self
{
if (!$this->hotels->contains($hotel)) {
$this->hotels[] = $hotel;
$hotel->setVilles($this);
}
return $this;
}
public function removeHotel(Hotel $hotel): self
{
if ($this->hotels->removeElement($hotel)) {
// set the owning side to null (unless already changed)
if ($hotel->getVilles() === $this) {
$hotel->setVilles(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
/**
* @return Collection<int, Coordonnescircuit>
*/
public function getCoordonnescircuits(): Collection
{
return $this->coordonnescircuits;
}
public function addCoordonnescircuit(Coordonnescircuit $coordonnescircuit): self
{
if (!$this->coordonnescircuits->contains($coordonnescircuit)) {
$this->coordonnescircuits[] = $coordonnescircuit;
$coordonnescircuit->setVille($this);
}
return $this;
}
public function removeCoordonnescircuit(Coordonnescircuit $coordonnescircuit): self
{
if ($this->coordonnescircuits->removeElement($coordonnescircuit)) {
// set the owning side to null (unless already changed)
if ($coordonnescircuit->getVille() === $this) {
$coordonnescircuit->setVille(null);
}
}
return $this;
}
}