Fixed duplicated fields on /api/booking/details and removed unnecesary ignore attributes.

This commit is contained in:
2024-09-28 00:03:05 +02:00
parent bfcd04c701
commit 986f422824
8 changed files with 65 additions and 73 deletions
+19 -17
View File
@@ -7,6 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Ignore;
#[ORM\Entity(repositoryClass: BookingRepository::class)]
class Booking
@@ -14,29 +15,30 @@ class Booking
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Ignore]
private ?int $id = null;
#[ORM\Column(length: 20)]
private ?string $refNumber = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $ArrivalDate = null;
private ?\DateTimeInterface $arrivalDate = null;
#[ORM\Column(type : Types::DATE_MUTABLE)]
private ?\DateTimeInterface $DepartureDate = null;
private ?\DateTimeInterface $departureDate = null;
#[ORM\Column(type : Types::DATETIMETZ_MUTABLE)]
private ?\DateTimeInterface $BookingTime = null;
private ?\DateTimeInterface $bookingTime = null;
#[ORM\OneToOne(mappedBy : 'Booking', cascade: ['persist', 'remove'])]
#[ORM\OneToOne(mappedBy: 'booking', cascade: ['persist', 'remove'])]
private ?BookingCustomer $bookingCustomer = null;
/**
* @var Collection<int, BookingRoom>
*/
#[ORM\OneToMany(targetEntity: BookingRoom::class, mappedBy: 'Booking', orphanRemoval: true, cascade: ['persist'])]
#[ORM\OneToMany(targetEntity: BookingRoom::class, mappedBy: 'booking', orphanRemoval: true, cascade: ['persist'])]
private Collection $bookingRooms;
#[ORM\Column(length: 20)]
private ?string $refNumber = null;
public function __construct()
{
$this->bookingRooms = new ArrayCollection();
@@ -49,36 +51,36 @@ class Booking
public function getArrivalDate(): ?\DateTimeInterface
{
return $this->ArrivalDate;
return $this->arrivalDate;
}
public function setArrivalDate(\DateTimeInterface $ArrivalDate): static
public function setArrivalDate(\DateTimeInterface $arrivalDate): static
{
$this->ArrivalDate = $ArrivalDate;
$this->arrivalDate = $arrivalDate;
return $this;
}
public function getDepartureDate(): ?\DateTimeInterface
{
return $this->DepartureDate;
return $this->departureDate;
}
public function setDepartureDate(\DateTimeInterface $DepartureDate): static
public function setDepartureDate(\DateTimeInterface $departureDate): static
{
$this->DepartureDate = $DepartureDate;
$this->departureDate = $departureDate;
return $this;
}
public function getBookingTime(): ?\DateTimeInterface
{
return $this->BookingTime;
return $this->bookingTime;
}
public function setBookingTime(\DateTimeInterface $BookingTime): static
public function setBookingTime(\DateTimeInterface $bookingTime): static
{
$this->BookingTime = $BookingTime;
$this->bookingTime = $bookingTime;
return $this;
}
+21 -22
View File
@@ -12,88 +12,87 @@ class BookingCustomer
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Ignore]
private ?int $id = null;
#[ORM\OneToOne(inversedBy: 'bookingCustomer', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
#[Ignore]
private ?Booking $Booking = null;
private ?Booking $booking = null;
#[ORM\Column(length: 64)]
private ?string $Name = null;
private ?string $name = null;
#[ORM\Column(length: 255)]
private ?string $Surname = null;
private ?string $surname = null;
#[ORM\Column(length: 255)]
private ?string $Email = null;
private ?string $email = null;
#[ORM\Column(length: 255)]
private ?string $PhoneNumber = null;
private ?string $phoneNumber = null;
public function getId(): ?int
{
return $this->id;
}
#[Ignore]
public function getBooking(): ?Booking
{
return $this->Booking;
return $this->booking;
}
#[Ignore]
public function setBooking(Booking $Booking): static
public function setBooking(Booking $booking): static
{
$this->Booking = $Booking;
$this->booking = $booking;
return $this;
}
public function getName(): ?string
{
return $this->Name;
return $this->name;
}
public function setName(string $Name): static
public function setName(string $name): static
{
$this->Name = $Name;
$this->name = $name;
return $this;
}
public function getSurname(): ?string
{
return $this->Surname;
return $this->surname;
}
public function setSurname(string $Surname): static
public function setSurname(string $surname): static
{
$this->Surname = $Surname;
$this->surname = $surname;
return $this;
}
public function getEmail(): ?string
{
return $this->Email;
return $this->email;
}
public function setEmail(string $Email): static
public function setEmail(string $email): static
{
$this->Email = $Email;
$this->email = $email;
return $this;
}
public function getPhoneNumber(): ?string
{
return $this->PhoneNumber;
return $this->phoneNumber;
}
public function setPhoneNumber(string $PhoneNumber): static
public function setPhoneNumber(string $phoneNumber): static
{
$this->PhoneNumber = $PhoneNumber;
$this->phoneNumber = $phoneNumber;
return $this;
}
+21 -24
View File
@@ -12,56 +12,53 @@ class BookingRoom
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Ignore]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'bookingRooms')]
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
#[Ignore]
private ?Booking $Booking = null;
private ?Booking $booking = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
#[Ignore]
private ?RoomCategory $RoomCategory = null;
private ?RoomCategory $roomCategory = null;
#[ORM\Column]
private ?int $GuestNumber = null;
private ?int $guestNumber = null;
#[ORM\Column]
private ?int $RoomPrice = null;
private ?int $roomPrice = null;
#[ORM\Column]
private ?int $Amount = null;
private ?int $amount = null;
public function getId(): ?int
{
return $this->id;
}
#[Ignore]
public function getBooking(): ?Booking
{
return $this->Booking;
return $this->booking;
}
#[Ignore]
public function setBooking(?Booking $Booking): static
public function setBooking(?Booking $booking): static
{
$this->Booking = $Booking;
$this->booking = $booking;
return $this;
}
#[Ignore]
public function getRoomCategory(): ?RoomCategory
{
return $this->RoomCategory;
return $this->roomCategory;
}
#[Ignore]
public function setRoomCategory(?RoomCategory $RoomCategory): static
public function setRoomCategory(?RoomCategory $roomCategory): static
{
$this->RoomCategory = $RoomCategory;
$this->roomCategory = $roomCategory;
return $this;
}
@@ -73,36 +70,36 @@ class BookingRoom
public function getGuestNumber(): ?int
{
return $this->GuestNumber;
return $this->guestNumber;
}
public function setGuestNumber(int $GuestNumber): static
public function setGuestNumber(int $guestNumber): static
{
$this->GuestNumber = $GuestNumber;
$this->guestNumber = $guestNumber;
return $this;
}
public function getRoomPrice(): ?int
{
return $this->RoomPrice;
return $this->roomPrice;
}
public function setRoomPrice(int $RoomPrice): static
public function setRoomPrice(int $roomPrice): static
{
$this->RoomPrice = $RoomPrice;
$this->roomPrice = $roomPrice;
return $this;
}
public function getAmount(): ?int
{
return $this->Amount;
return $this->amount;
}
public function setAmount(int $Amount): static
public function setAmount(int $amount): static
{
$this->Amount = $Amount;
$this->amount = $amount;
return $this;
}
+1 -1
View File
@@ -164,7 +164,7 @@ class FareTable
/**
* Obtiene las tarifas que aplican al GuestNumber indicado.
* @param int $guestNumber GuestNumber para búsqueda.
* @return RoomFare[] Lista de tarifas.
* @return Collection<RoomFare> Lista de tarifas.
*/
public function getRoomFaresByGuestNumber(int $guestNumber)
{
+1 -4
View File
@@ -18,6 +18,7 @@ class RoomCategoryBedType
#[ORM\Id]
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
#[Ignore]
private ?BedType $bedType = null;
#[ORM\Column]
@@ -40,13 +41,11 @@ class RoomCategoryBedType
return $this;
}
#[Ignore]
public function getRoomCategory(): ?RoomCategory
{
return $this->roomCategory;
}
#[Ignore]
public function setRoomCategory(?RoomCategory $roomCategory): static
{
$this->roomCategory = $roomCategory;
@@ -54,13 +53,11 @@ class RoomCategoryBedType
return $this;
}
#[Ignore]
public function getBedType(): ?BedType
{
return $this->bedType;
}
#[Ignore]
public function setBedType(?BedType $bedType): static
{
$this->bedType = $bedType;
-3
View File
@@ -29,7 +29,6 @@ class RoomCategoryPhoto
#[Ignore]
private ?RoomCategory $roomCategory = null;
#[Ignore]
public function getId(): ?int
{
return $this->id;
@@ -71,13 +70,11 @@ class RoomCategoryPhoto
return $this;
}
#[Ignore]
public function getRoomCategory(): ?RoomCategory
{
return $this->roomCategory;
}
#[Ignore]
public function setRoomCategory(?RoomCategory $roomCategory): static
{
$this->roomCategory = $roomCategory;
+1 -1
View File
@@ -39,7 +39,7 @@ class ConfigVariableService
}
}
private function AddConfigVariable(string $key, string $value, string $section) : Returntype {
private function AddConfigVariable(string $key, string $value, string $section): void {
}
+1 -1
View File
@@ -127,7 +127,7 @@ class PricesService
/**
* Calcula el precio a aplicar según las condiciones de las tarifas.
* @param RoomFare[] $roomFareList Lista con las posibles tarifas.
* @param Collection<RoomFare> $roomFareList Lista con las posibles tarifas.
* @param DateTimeInterface $fareCondDate Fecha utilizada para las condiciones.
*
*/