<?php
namespace App\Entity;
use App\Repository\ChambreRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ChambreRepository::class)
*/
class Chambre
{
/**
* @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\Column(type="integer", nullable=true)
*/
private $capacity;
/**
* @ORM\ManyToMany(targetEntity=Hotel::class, mappedBy="hotelroom")
*/
private $hotels;
public function __construct()
{
$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;
}
public function getCapacity(): ?int
{
return $this->capacity;
}
public function setCapacity(?int $capacity): self
{
$this->capacity = $capacity;
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->addHotelroom($this);
}
return $this;
}
public function removeHotel(Hotel $hotel): self
{
if ($this->hotels->removeElement($hotel)) {
$hotel->removeHotelroom($this);
}
return $this;
}
}