forked from Somnia/SomniaRooms
Implemented entities for new RoomCategory BedType system.
This commit is contained in:
+37
-15
@@ -22,9 +22,6 @@ class RoomCategory
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 64, nullable: true)]
|
||||
private ?string $bedType = null;
|
||||
|
||||
#[ORM\Column(nullable: false)]
|
||||
private ?int $maxGuestNum = null;
|
||||
|
||||
@@ -34,9 +31,16 @@ class RoomCategory
|
||||
#[ORM\OneToMany(targetEntity: RoomCategoryPhoto::class, mappedBy: 'roomCategory', orphanRemoval: true, cascade: ['persist'])]
|
||||
private Collection $roomCategoryPhotos;
|
||||
|
||||
/**
|
||||
* @var Collection<int, RoomCategoryBedType>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: RoomCategoryBedType::class, mappedBy: 'roomCategory', orphanRemoval: true, cascade: ['persist'])]
|
||||
private Collection $roomCategoryBedTypes;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->roomCategoryPhotos = new ArrayCollection();
|
||||
$this->roomCategoryBedTypes = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -68,18 +72,6 @@ class RoomCategory
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBedType(): ?string
|
||||
{
|
||||
return $this->bedType;
|
||||
}
|
||||
|
||||
public function setBedType(?string $bedType): static
|
||||
{
|
||||
$this->bedType = $bedType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMaxGuestNum(): ?int
|
||||
{
|
||||
return $this->maxGuestNum;
|
||||
@@ -126,4 +118,34 @@ class RoomCategory
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, RoomCategoryBedType>
|
||||
*/
|
||||
public function getRoomCategoryBedTypes(): Collection
|
||||
{
|
||||
return $this->roomCategoryBedTypes;
|
||||
}
|
||||
|
||||
public function addRoomCategoryBedType(RoomCategoryBedType $roomCategoryBedType): static
|
||||
{
|
||||
if (!$this->roomCategoryBedTypes->contains($roomCategoryBedType)) {
|
||||
$this->roomCategoryBedTypes->add($roomCategoryBedType);
|
||||
$roomCategoryBedType->setRoomCategory($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeRoomCategoryBedType(RoomCategoryBedType $roomCategoryBedType): static
|
||||
{
|
||||
if ($this->roomCategoryBedTypes->removeElement($roomCategoryBedType)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($roomCategoryBedType->getRoomCategory() === $this) {
|
||||
$roomCategoryBedType->setRoomCategory(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user