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\Form\Model\BookingDto;
|
||||
use App\Form\Service\DummyDataFillService;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSessionService;
|
||||
use App\Service\BookingSummaryDataService;
|
||||
use App\Service\ParticipantFormSupportService;
|
||||
use App\Service\TravelDataService;
|
||||
@@ -27,6 +28,7 @@ class Step2ParticipantController extends AbstractController
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly BookingSessionService $bookingSessionService,
|
||||
private readonly BookingSummaryDataService $summaryDataService,
|
||||
private readonly TravelDataService $travelDataService,
|
||||
private readonly DummyDataFillService $dummyDataFillService,
|
||||
@@ -68,7 +70,7 @@ class Step2ParticipantController extends AbstractController
|
||||
|
||||
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||
$this->bookingService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
|
||||
$this->bookingSessionService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
|
||||
|
||||
$form = $this->createParticipantForm($bookingDto, $index);
|
||||
|
||||
@@ -83,7 +85,7 @@ class Step2ParticipantController extends AbstractController
|
||||
$notifications = $this->participantFormSupportService->collectAndClearNotifications($bookingDto);
|
||||
|
||||
if (true === $isSubmitted && true === $form->isValid()) {
|
||||
$this->bookingService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
|
||||
$this->bookingSessionService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
|
||||
$this->addNotificationsAsFlashMessages($notifications);
|
||||
|
||||
return $this->redirectToRoute('app_booking_create_step_2');
|
||||
@@ -137,7 +139,7 @@ class Step2ParticipantController extends AbstractController
|
||||
|
||||
private function loadBookingDtoOrRedirect(Request $request): BookingDto|Response
|
||||
{
|
||||
$bookingDto = $this->bookingService->getBookingDto($request, BookingDto::MODE_CREATE);
|
||||
$bookingDto = $this->bookingSessionService->getBookingDto($request, BookingDto::MODE_CREATE);
|
||||
|
||||
if (null === $bookingDto) {
|
||||
$this->addFlash('info', 'Deine Sitzung ist abgelaufen. Bitte starte eine neue Buchung.');
|
||||
@@ -186,7 +188,7 @@ class Step2ParticipantController extends AbstractController
|
||||
|
||||
$notifications = $this->participantFormSupportService->collectAndClearNotifications($bookingDto);
|
||||
|
||||
$this->bookingService->saveBookingDto($request, $bookingDto, $bookingDto->getMode());
|
||||
$this->bookingSessionService->saveBookingDto($request, $bookingDto, $bookingDto->getMode());
|
||||
|
||||
$summaryData = $this->summaryDataService->getSummaryData($bookingDto);
|
||||
|
||||
|
||||
Reference in new issue
Block a user