<?php
namespace App\Entity;
use App\Repository\CenterRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CenterRepository::class)
*/
class Center
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $country;
/**
* @ORM\OneToOne(targetEntity=Address::class, cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
private $address;
/**
* @ORM\OneToMany(targetEntity=Room::class, mappedBy="center")
*/
private $rooms;
/**
* @ORM\OneToMany(targetEntity=Reservation::class, mappedBy="center")
*/
private $reservations;
/**
* @ORM\OneToMany(targetEntity=StatWeight::class, mappedBy="center")
*/
private $statWeights;
/**
* @ORM\OneToMany(targetEntity=StatReservation::class, mappedBy="center")
*/
private $statReservations;
/**
* @ORM\Column(type="text")
*/
private $description;
public function __construct()
{
$this->rooms = new ArrayCollection();
$this->reservations = new ArrayCollection();
$this->statWeights = new ArrayCollection();
$this->statReservations = new ArrayCollection();
}
public function __toString()
{
return $this->name ;
}
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 getCountry(): ?string
{
return $this->country;
}
public function setCountry(string $country): self
{
$this->country = $country;
return $this;
}
public function getAddress(): ?Address
{
return $this->address;
}
public function setAddress(Address $address): self
{
$this->address = $address;
return $this;
}
/**
* @return Collection<int, Room>
*/
public function getRooms(): Collection
{
return $this->rooms;
}
public function addRoom(Room $room): self
{
if (!$this->rooms->contains($room)) {
$this->rooms[] = $room;
$room->setCenter($this);
}
return $this;
}
public function removeRoom(Room $room): self
{
if ($this->rooms->removeElement($room)) {
// set the owning side to null (unless already changed)
if ($room->getCenter() === $this) {
$room->setCenter(null);
}
}
return $this;
}
/**
* @return Collection<int, Reservation>
*/
public function getReservations(): Collection
{
return $this->reservations;
}
public function addReservation(Reservation $reservation): self
{
if (!$this->reservations->contains($reservation)) {
$this->reservations[] = $reservation;
$reservation->setCenter($this);
}
return $this;
}
public function removeReservation(Reservation $reservation): self
{
if ($this->reservations->removeElement($reservation)) {
// set the owning side to null (unless already changed)
if ($reservation->getCenter() === $this) {
$reservation->setCenter(null);
}
}
return $this;
}
/**
* @return Collection<int, StatWeight>
*/
public function getStatWeights(): Collection
{
return $this->statWeights;
}
public function addStatWeight(StatWeight $statWeight): self
{
if (!$this->statWeights->contains($statWeight)) {
$this->statWeights[] = $statWeight;
$statWeight->setCenter($this);
}
return $this;
}
public function removeStatWeight(StatWeight $statWeight): self
{
if ($this->statWeights->removeElement($statWeight)) {
// set the owning side to null (unless already changed)
if ($statWeight->getCenter() === $this) {
$statWeight->setCenter(null);
}
}
return $this;
}
/**
* @return Collection<int, StatReservation>
*/
public function getStatReservations(): Collection
{
return $this->statReservations;
}
public function addStatReservation(StatReservation $statReservation): self
{
if (!$this->statReservations->contains($statReservation)) {
$this->statReservations[] = $statReservation;
$statReservation->setCenter($this);
}
return $this;
}
public function removeStatReservation(StatReservation $statReservation): self
{
if ($this->statReservations->removeElement($statReservation)) {
// set the owning side to null (unless already changed)
if ($statReservation->getCenter() === $this) {
$statReservation->setCenter(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
}