<?php
namespace App\Entity;
use App\Repository\BedroomRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BedroomRepository::class)]
#[ORM\Table(name: '`bedroom`')]
class Bedroom
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bedroom_name = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bedroom_size = null;
#[ORM\Column(nullable: true)]
private ?bool $bedroom_furnished = null;
#[ORM\Column(nullable: true)]
private ?float $bedroom_price = null;
#[ORM\Column(nullable: true)]
private ?bool $natural_light = null;
#[ORM\Column(nullable: true)]
private ?bool $bedroom_ensuite = null;
#[ORM\Column(nullable: true)]
private ?bool $bedroom_available = null;
/*
#[ORM\ManyToOne(inversedBy: 'bedrooms')]
#[ORM\JoinColumn(nullable: TRUE)]
private ?PropertyDetails $propertyDetails = null;
*/
#[ORM\OneToMany(mappedBy: 'bedroom_image', targetEntity: Image::class, cascade: ['persist'])]
private Collection $images;
#[ORM\OneToMany(mappedBy: 'bedroom_videos', targetEntity: Videos::class, cascade: ['persist'])]
private Collection $videos;
#[ORM\ManyToOne(inversedBy: 'bedrooms')]
private ?PropertyDetails $propertyDetails = null;
#[ORM\Column(nullable: true)]
private ?bool $isRented = null;
#[ORM\OneToMany(mappedBy: 'bedroom', targetEntity: Tenants::class, cascade: ['persist'])]
#[ORM\OrderBy(["id"=>"ASC"])]
private Collection $tenants;
public function __construct()
{
$this->images = new ArrayCollection();
$this->videos = new ArrayCollection();
$this->tenants = new ArrayCollection();
}
public function __toString(): string
{
return $this->getBedroomName();
}
// #[ORM\ManyToOne(inversedBy: 'bedrooms')]
// #[ORM\JoinColumn(nullable: false)]
// private ?PropertyList $property = null;
public function getId(): ?int
{
return $this->id;
}
public function getBedroomName(): ?string
{
return $this->bedroom_name;
}
public function setBedroomName(string $bedroom_name): self
{
$this->bedroom_name = $bedroom_name;
return $this;
}
public function getBedroomSize(): ?string
{
return $this->bedroom_size;
}
public function setBedroomSize(?string $bedroom_size): self
{
$this->bedroom_size = $bedroom_size;
return $this;
}
public function isBedroomFurnished(): ?bool
{
return $this->bedroom_furnished;
}
public function setBedroomFurnished(?bool $bedroom_furnished): self
{
$this->bedroom_furnished = $bedroom_furnished;
return $this;
}
public function getBedroomPrice(): ?float
{
return $this->bedroom_price;
}
public function setBedroomPrice(?float $bedroom_price): self
{
$this->bedroom_price = $bedroom_price;
return $this;
}
public function isNaturalLight(): ?bool
{
return $this->natural_light;
}
public function setNaturalLight(?bool $natural_light): self
{
$this->natural_light = $natural_light;
return $this;
}
public function isBedroomEnsuite(): ?bool
{
return $this->bedroom_ensuite;
}
public function setBedroomEnsuite(?bool $bedroom_ensuite): self
{
$this->bedroom_ensuite = $bedroom_ensuite;
return $this;
}
public function isBedroomAvailable(): ?bool
{
return $this->bedroom_available;
}
public function setBedroomAvailable(?bool $bedroom_available): self
{
$this->bedroom_available = $bedroom_available;
return $this;
}
/**
* @return Collection<int, Image>
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Image $image): self
{
if (!$this->images->contains($image)) {
$this->images->add($image);
$image->setBedroomImage($this);
}
return $this;
}
public function removeImage(Image $image): self
{
if ($this->images->removeElement($image)) {
// set the owning side to null (unless already changed)
if ($image->getBedroomImage() === $this) {
$image->setBedroomImage(null);
}
}
return $this;
}
/**
* @return Collection<int, Videos>
*/
public function getVideos(): Collection
{
return $this->videos;
}
public function addVideo(Videos $video): self
{
if (!$this->videos->contains($video)) {
$this->videos->add($video);
$video->setBedroomVideos($this);
}
return $this;
}
public function removeVideo(Videos $video): self
{
if ($this->videos->removeElement($video)) {
// set the owning side to null (unless already changed)
if ($video->getBedroomVideos() === $this) {
$video->setBedroomVideos(null);
}
}
return $this;
}
public function getPropertyDetails(): ?PropertyDetails
{
return $this->propertyDetails;
}
public function setPropertyDetails(?PropertyDetails $propertyDetails): self
{
$this->propertyDetails = $propertyDetails;
return $this;
}
public function isIsRented(): ?bool
{
return $this->isRented;
}
public function setIsRented(?bool $isRented): self
{
$this->isRented = $isRented;
return $this;
}
/**
* @return Collection<int, Tenants>
*/
public function getTenants(): Collection
{
return $this->tenants;
}
public function addTenant(Tenants $tenant): self
{
if (!$this->tenants->contains($tenant)) {
$this->tenants->add($tenant);
$tenant->setBedroom($this);
}
return $this;
}
public function removeTenant(Tenants $tenant): self
{
if ($this->tenants->removeElement($tenant)) {
// set the owning side to null (unless already changed)
if ($tenant->getBedroom() === $this) {
$tenant->setBedroom(null);
}
}
return $this;
}
}