<?php
namespace App\Entity;
use App\Repository\ThemesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ThemesRepository::class)
*/
class Themes
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="boolean")
*/
private $etat;
/**
* @ORM\OneToMany(targetEntity=Sejour::class, mappedBy="themes")
*/
private $sejours;
/**
* @ORM\ManyToMany(targetEntity=Hotel::class, mappedBy="hotelthemes")
*/
private $hotels;
public function __construct()
{
$this->sejours = new ArrayCollection();
$this->hotels = 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;
}
/**
* @return Collection<int, Sejour>
*/
public function getSejours(): Collection
{
return $this->sejours;
}
public function addSejour(Sejour $sejour): self
{
if (!$this->sejours->contains($sejour)) {
$this->sejours[] = $sejour;
$sejour->setThemes($this);
}
return $this;
}
public function removeSejour(Sejour $sejour): self
{
if ($this->sejours->removeElement($sejour)) {
// set the owning side to null (unless already changed)
if ($sejour->getThemes() === $this) {
$sejour->setThemes(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
/**
* @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->addHoteltheme($this);
}
return $this;
}
public function removeHotel(Hotel $hotel): self
{
if ($this->hotels->removeElement($hotel)) {
$hotel->removeHoteltheme($this);
}
return $this;
}
}