feat: centralize create/edit flow contexts, extract edit submit service
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Model;
|
||||
|
||||
use App\BusProNet\Model\Room;
|
||||
|
||||
/**
|
||||
* Bundles the data needed to render the booking create flow.
|
||||
*/
|
||||
class BookingCreateContext
|
||||
{
|
||||
/**
|
||||
* @param array{by_pax: array<int, Room>, by_room: array<int, Room>} $groupedRooms
|
||||
* @param array<int, ParticipantCardDataDto>|null $cardsData
|
||||
* @param array<int, float>|null $participantPrices
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly BookingDto $bookingDto,
|
||||
public readonly BookingSummaryDto $summaryData,
|
||||
public readonly array $groupedRooms,
|
||||
public readonly ?array $cardsData = null,
|
||||
public readonly bool $isSubmitted = false,
|
||||
public readonly ?array $participantPrices = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Model;
|
||||
|
||||
use App\BusProNet\Model\BaseData;
|
||||
use App\BusProNet\Model\Booking;
|
||||
|
||||
/**
|
||||
* Bundles the data needed to render the booking edit flow.
|
||||
*/
|
||||
class BookingEditContext
|
||||
{
|
||||
/**
|
||||
* @param array<int, ParticipantCardDataDto>|null $cardsData
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly BookingDto $bookingDto,
|
||||
public readonly ?Booking $bookingData,
|
||||
public readonly ?BaseData $mutableData,
|
||||
public readonly BookingSummaryDto $summaryData,
|
||||
public readonly ?array $cardsData = null,
|
||||
public readonly bool $isDirty = false,
|
||||
public readonly bool $isSubmitted = false,
|
||||
public readonly bool $hasValidationErrors = false,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Model;
|
||||
|
||||
use App\BusProNet\Model\BaseData;
|
||||
use App\BusProNet\Model\Booking;
|
||||
|
||||
/**
|
||||
* Bundles the data needed to render an edit-participant page.
|
||||
*/
|
||||
class BookingEditParticipantContext
|
||||
{
|
||||
public function __construct(
|
||||
public readonly BookingDto $bookingDto,
|
||||
public readonly Booking $bookingData,
|
||||
public readonly ?BaseData $mutableData,
|
||||
public readonly BookingSummaryDto $summaryData,
|
||||
) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user