wip: booking process, refactoring

This commit is contained in:
Björn Fromme
2025-07-16 19:37:17 +02:00
parent 47faa6b08e
commit eecea0abd1
43 changed files with 2269 additions and 366 deletions
+11 -4
View File
@@ -9,7 +9,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
class BookingCreateDto
{
public int $currentStep = 1;
#[Assert\Valid]
/**
* @var array<int, RoomSelectionDto>
@@ -26,7 +26,7 @@ class BookingCreateDto
{
}
#[Assert\Callback]
#[Assert\Callback(groups: ['booking_create_step_1'])]
public function assertValidRoomSelections(ExecutionContextInterface $context): void
{
$participantsCount = $this->getParticipantsCount();
@@ -57,8 +57,15 @@ class BookingCreateDto
foreach ($this->roomSelections as $roomSelection) {
$room = $rooms[$roomSelection->roomId];
$participantsCount += $room->minPax * $roomSelection->quantity;
}
}
return $participantsCount;
}
}
public function getSelectedRooms(): array
{
return array_filter($this->roomSelections, function (RoomSelectionDto $roomSelection) {
return 0 < $roomSelection->quantity;
});
}
}