src/Entity/Room.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RoomRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Table(name'`escappart_room`')]
  8. #[ORM\Entity(repositoryClassRoomRepository::class)]
  9. class Room
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $name null;
  17.     #[ORM\Column(length255nullabletrue)]
  18.     private ?string $color null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $bedsId null;
  21.     #[ORM\ManyToOne(inversedBy'rooms'cascade: ['persist''remove'])]
  22.     #[ORM\JoinColumn(nullablefalse)]
  23.     private ?Hotel $hotel null;
  24.     #[ORM\OneToMany(mappedBy'room'targetEntityBooking::class, orphanRemovaltrue)]
  25.     private Collection $bookings;
  26.     #[ORM\OneToMany(mappedBy'room'targetEntitySeasonalFinance::class)]
  27.     #[ORM\OrderBy(['season' => 'ASC'])]
  28.     private Collection $seasonalFinances;
  29.     #[ORM\OneToMany(mappedBy'room'targetEntityAccounting::class, orphanRemovaltrue)]
  30.     private Collection $accountings;
  31.     #[ORM\OneToMany(mappedBy'room'targetEntityRoomUser::class, orphanRemovaltrue)]
  32.     private Collection $roomUsers;
  33.     #[ORM\OneToMany(mappedBy'room'targetEntityFee::class)]
  34.     private Collection $fees;
  35.     public function __construct(Hotel $hotel)
  36.     {
  37.         $this->bookings = new ArrayCollection();
  38.         $this->seasonalFinances = new ArrayCollection();
  39.         $this->accountings = new ArrayCollection();
  40.         $this->roomUsers = new ArrayCollection();
  41.         $this->setHotel($hotel);
  42.         $this->fees = new ArrayCollection();
  43.     }
  44.     
  45.     public function __toString() {
  46.         return $this->name;
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getName(): ?string
  53.     {
  54.         return $this->name;
  55.     }
  56.     public function setName(string $name): self
  57.     {
  58.         $this->name $name;
  59.         return $this;
  60.     }
  61.     public function getColor(): ?string
  62.     {
  63.         return $this->color;
  64.     }
  65.     public function setColor(?string $color): self
  66.     {
  67.         $this->color $color;
  68.         return $this;
  69.     }
  70.     public function getBedsId(): ?string
  71.     {
  72.         return $this->bedsId;
  73.     }
  74.     public function setBedsId(?string $bedsId): self
  75.     {
  76.         $this->bedsId $bedsId;
  77.         return $this;
  78.     }
  79.     public function getHotel(): ?Hotel
  80.     {
  81.         return $this->hotel;
  82.     }
  83.     public function setHotel(?Hotel $hotel): self
  84.     {
  85.         $this->hotel $hotel;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return Collection<int, Booking>
  90.      */
  91.     public function getBookings(): Collection
  92.     {
  93.         return $this->bookings;
  94.     }
  95.     public function addBooking(Booking $booking): self
  96.     {
  97.         if (!$this->bookings->contains($booking)) {
  98.             $this->bookings->add($booking);
  99.             $booking->setRoom($this);
  100.         }
  101.         return $this;
  102.     }
  103.     public function removeBooking(Booking $booking): self
  104.     {
  105.         if ($this->bookings->removeElement($booking)) {
  106.             // set the owning side to null (unless already changed)
  107.             if ($booking->getRoom() === $this) {
  108.                 $booking->setRoom(null);
  109.             }
  110.         }
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection<int, Accounting>
  115.      */
  116.     public function getAccountings(): Collection
  117.     {
  118.         return $this->accountings;
  119.     }
  120.     public function addAccounting(Accounting $accounting): self
  121.     {
  122.         if (!$this->accountings->contains($accounting)) {
  123.             $this->accountings->add($accounting);
  124.             $accounting->setRoom($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeAccounting(Accounting $accounting): self
  129.     {
  130.         if ($this->accountings->removeElement($accounting)) {
  131.             // set the owning side to null (unless already changed)
  132.             if ($accounting->getRoom() === $this) {
  133.                 $accounting->setRoom(null);
  134.             }
  135.         }
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection<int, RoomUser>
  140.      */
  141.     public function getRoomUsers(): Collection
  142.     {
  143.         return $this->roomUsers;
  144.     }
  145.     public function addRoomUser(RoomUser $roomUser): self
  146.     {
  147.         if (!$this->roomUsers->contains($roomUser)) {
  148.             $this->roomUsers->add($roomUser);
  149.             $roomUser->setRoom($this);
  150.         }
  151.         return $this;
  152.     }
  153.     public function removeRoomUser(RoomUser $roomUser): self
  154.     {
  155.         if ($this->roomUsers->removeElement($roomUser)) {
  156.             // set the owning side to null (unless already changed)
  157.             if ($roomUser->getRoom() === $this) {
  158.                 $roomUser->setRoom(null);
  159.             }
  160.         }
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection<int, Fee>
  165.      */
  166.     public function getFees(): Collection
  167.     {
  168.         return $this->fees;
  169.     }
  170.     public function addFee(Fee $fee): self
  171.     {
  172.         if (!$this->fees->contains($fee)) {
  173.             $this->fees->add($fee);
  174.             $fee->setRoom($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeFee(Fee $fee): self
  179.     {
  180.         if ($this->fees->removeElement($fee)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($fee->getRoom() === $this) {
  183.                 $fee->setRoom(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188.     /**
  189.      * @return Collection<int, SeasonalFinance>
  190.      */
  191.     public function getSeasonalFinances(): Collection
  192.     {
  193.         return $this->seasonalFinances;
  194.     }
  195.     public function addSeasonalFinance(SeasonalFinance $seasonalFinance): self
  196.     {
  197.         if (!$this->seasonalFinances->contains($seasonalFinance)) {
  198.             $this->seasonalFinances->add($seasonalFinance);
  199.             $seasonalFinance->setRoom($this);
  200.         }
  201.         return $this;
  202.     }
  203.     public function removeSeasonalFinance(SeasonalFinance $seasonalFinance): self
  204.     {
  205.         if ($this->seasonalFinances->removeElement($seasonalFinance)) {
  206.             // set the owning side to null (unless already changed)
  207.             if ($seasonalFinance->getRoom() === $this) {
  208.                 $seasonalFinance->setRoom(null);
  209.             }
  210.         }
  211.         return $this;
  212.     }
  213. }