wip: form refactoring
This commit is contained in:
1 parent
2b122a7cc4
commit
ae2ed306b9
13 files changed
+158
-100
No files matched your search
@@ -10,18 +10,19 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class BookingEditDto implements BookingDtoInterface
|
||||
{
|
||||
public ?Booking $booking = null;
|
||||
public ?Travel $travel = null;
|
||||
|
||||
/**
|
||||
* @var array<int, ParticipantDto>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
public array $participants = [];
|
||||
|
||||
public function __construct(public Booking $booking, public Travel $travel)
|
||||
{
|
||||
}
|
||||
|
||||
public static function fromBooking(Booking $booking, Travel $travel): static
|
||||
{
|
||||
$instance = new static();
|
||||
$instance = new static($booking, $travel);
|
||||
|
||||
$instance->booking = $booking;
|
||||
$instance->travel = $travel;
|
||||
@@ -69,11 +70,6 @@ class BookingEditDto implements BookingDtoInterface
|
||||
return $this->participants;
|
||||
}
|
||||
|
||||
public function getTravel(): Travel
|
||||
{
|
||||
return $this->travel;
|
||||
}
|
||||
|
||||
public function hasParticipant(int $index): bool
|
||||
{
|
||||
return isset($this->participants[$index]);
|
||||
@@ -87,7 +83,7 @@ class BookingEditDto implements BookingDtoInterface
|
||||
/**
|
||||
* Gets all selected rooms for the booking (edit context).
|
||||
*
|
||||
* @return array<int, RoomSelectionDto> Always returns an empty array for edit DTOs unless implemented.
|
||||
* @return array<int, RoomSelectionDto> always returns an empty array for edit DTOs unless implemented
|
||||
*/
|
||||
public function getSelectedRooms(): array
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user