feat: extract booking session handling

This commit is contained in:
Björn Fromme
2026-04-11 18:28:32 +02:00
parent ca052682bb
commit 8b72f8c277
21 changed files with 485 additions and 330 deletions
@@ -16,6 +16,7 @@ use App\Htmx\HxTrait;
use App\Entity\User;
use App\Service\BookingPriceCalculatorService;
use App\Service\BookingService;
use App\Service\BookingSessionService;
use App\Service\BookingSummaryDataService;
use App\Service\Newsletter\MailjetNewsletterService;
use App\Service\Newsletter\NewsletterDoubleOptInService;
@@ -38,6 +39,7 @@ class Step4Controller extends AbstractController
public function __construct(
private readonly BookingService $bookingService,
private readonly BookingSessionService $bookingSessionService,
private readonly BookingSummaryDataService $summaryDataService,
private readonly BookingPriceCalculatorService $priceCalculator,
private readonly ApiClient $apiClient,
@@ -54,7 +56,7 @@ class Step4Controller extends AbstractController
#[Route('/bookings/create/confirmation', name: 'app_booking_create_step_4')]
public function index(Request $request): Response
{
$result = $this->getOrCreateBookingCreateDto($this->bookingService, $request);
$result = $this->getOrCreateBookingCreateDto($this->bookingSessionService, $request);
if ($result instanceof Response) {
return $result;
}
@@ -137,7 +139,7 @@ class Step4Controller extends AbstractController
$this->addFlash('booking_total', $summaryData->payableAmount);
$this->addFlash('booking_travel_name', $bookingCreateDto->travel->label);
$this->clearTravelDataCache($bookingCreateDto);
$this->bookingService->clearBookingDto($request, BookingDto::MODE_CREATE);
$this->bookingSessionService->clearBookingDto($request, BookingDto::MODE_CREATE);
$this->logger->info('Booking successfully created.', [
'date_id' => $bookingCreateDto->travel->id,