feat: load cms data early to display image on login page

This commit is contained in:
Björn Fromme
2026-03-16 12:00:55 +01:00
parent ce88e1f97b
commit 15fdfdc42e
4 changed files with 56 additions and 14 deletions
+17 -2
View File
@@ -3,6 +3,7 @@
namespace App\Controller;
use App\Service\BookingService;
use App\Service\BookingSummaryDataService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -14,8 +15,12 @@ class SecurityController extends AbstractController
{
#[Route('/', name: 'app_login')]
#[IsGranted('PUBLIC_ACCESS')]
public function login(AuthenticationUtils $authenticationUtils, Request $request, BookingService $bookingService): Response
{
public function login(
AuthenticationUtils $authenticationUtils,
Request $request,
BookingService $bookingService,
BookingSummaryDataService $summaryDataService,
): Response {
// Check if this is a booking flow (BookingDto exists in session)
$bookingDto = $bookingService->getBookingDto($request, BookingService::BOOKING_CREATE_KEY);
$isBookingFlow = null !== $bookingDto;
@@ -50,12 +55,22 @@ class SecurityController extends AbstractController
// Render booking login template if in booking flow, otherwise standard login
$template = true === $isBookingFlow ? 'booking/create/authenticate.html.twig' : 'security/login.html.twig';
// Fetch CMS data for booking flow (uses cache warmed in IndexController)
$cmsData = null;
if (true === $isBookingFlow) {
$cmsData = $summaryDataService->getCmsDataForProduct(
$bookingDto->travel->productCode,
$bookingDto->travel->hotel?->code
);
}
return $this->render($template, [
'last_username' => $lastUsername,
'error' => $error,
'travel_title' => $bookingDto?->travel->label,
'travel_date_from' => $bookingDto?->travel->dateFrom,
'travel_date_to' => $bookingDto?->travel->dateTo,
'cmsData' => $cmsData,
]);
}