feat: extract booking session handling
This commit is contained in:
1 parent
ca052682bb
commit
8b72f8c277
21 files changed
+485
-330
No files matched your search
@@ -9,6 +9,7 @@ use App\Controller\Booking\Traits\BookingExceptionHandlerTrait;
|
||||
use App\Form\BookingCreateStep2Type;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingSummaryDataService;
|
||||
use App\Service\ParticipantCardDataService;
|
||||
use App\Service\ParticipantPrepopulationService;
|
||||
@@ -32,6 +33,7 @@ class Step2Controller extends AbstractController
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingSummaryDataService $summaryDataService,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly RoomAssignmentService $roomAssignmentService,
|
||||
@@ -47,7 +49,7 @@ class Step2Controller extends AbstractController
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
// Load or create booking DTO
|
||||
$result = $this->getOrCreateBookingCreateDto($this->bookingService, $request);
|
||||
$result = $this->getOrCreateBookingCreateDto($this->bookingSessionService, $request);
|
||||
if ($result instanceof Response) {
|
||||
return $result;
|
||||
}
|
||||
@@ -79,7 +81,7 @@ class Step2Controller extends AbstractController
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingCreateDto);
|
||||
|
||||
// Save BookingDto to session
|
||||
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
$this->bookingSessionService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
|
||||
// Create validation form
|
||||
$form = $this->createForm(BookingCreateStep2Type::class, $bookingCreateDto);
|
||||
@@ -89,7 +91,7 @@ class Step2Controller extends AbstractController
|
||||
if (true === $form->isSubmitted() && true === $form->isValid()) {
|
||||
// All participants validated successfully, update current step
|
||||
$bookingCreateDto->currentStep = 3;
|
||||
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
$this->bookingSessionService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
|
||||
// Proceed to Step 3
|
||||
return $this->redirectToRoute('app_booking_create_step_3');
|
||||
|
||||
Reference in new issue
Block a user