feat: reword flash messages, add logging

This commit is contained in:
Björn Fromme
2026-08-13 15:08:34 +02:00
parent d74127ebe2
commit bf69fcceff
2 changed files with 20 additions and 4 deletions
@@ -19,6 +19,7 @@ use App\Service\BookingEditDraftManager;
use App\Service\BookingEditPreFlightChecker;
use App\Service\BookingEditSubmitter;
use App\Service\BookingSessionManager;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -47,6 +48,7 @@ class IndexController extends AbstractController
private readonly BookingEditContextFactory $editContextFactory,
private readonly BookingEditPreFlightChecker $preFlightChecker,
private readonly BookingEditSubmitter $formSubmitter,
private readonly LoggerInterface $logger,
) {
}
@@ -83,13 +85,19 @@ class IndexController extends AbstractController
try {
$bookingDto = $this->dataLoader->loadFormData($request, $bookingId, $user);
} catch (TravelNotFoundException) {
$this->addFlash('error', 'Reisedaten sind nicht (mehr) verfügbar');
$this->logger->error('Unable to fetch travel data', [
'booking_id' => $bookingId,
]);
$this->addFlash('error', 'Die Reisedaten können aktuell nicht abgerufen werden. Bitte versuche es später oder wende dich an den Kundenservice.');
return $this->redirectToRoute('app_bookings');
}
if (null === $bookingDto) {
$this->addFlash('error', 'Buchungsdaten nicht (mehr) verfügbar');
$this->logger->error('Unable to fetch booking data', [
'booking_id' => $bookingId,
]);
$this->addFlash('error', 'Die Buchungsdaten können aktuell nicht abgerufen werden. Bitte versuche es später oder wende dich an den Kundenservice.');
return $this->redirectToRoute('app_bookings');
}
@@ -111,7 +119,10 @@ class IndexController extends AbstractController
// Fetch booking data for display (surcharges, canceled status, etc.)
$bookingData = $this->dataLoader->fetchBookingData($bookingId, $user);
if (null === $bookingData || $bookingData instanceof Notification) {
$this->addFlash('error', 'Buchungsdaten nicht (mehr) verfügbar');
$this->logger->error('Unable to fetch booking data', [
'booking_id' => $bookingId,
]);
$this->addFlash('error', 'Die Buchungsdaten können aktuell nicht abgerufen werden. Bitte versuche es später oder wende dich an den Kundenservice.');
return $this->redirectToRoute('app_bookings');
}
@@ -17,6 +17,7 @@ use App\Service\BookingConfigurator;
use App\Service\ParticipantDataPrefiller;
use App\Service\BookingSessionManager;
use App\Service\ParticipantFormSupport;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -39,6 +40,7 @@ class ParticipantController extends AbstractController
private readonly BookingSessionManager $bookingSessionService,
private readonly ParticipantDataPrefiller $prepopulationService,
private readonly ParticipantFormSupport $participantFormSupportService,
private readonly LoggerInterface $logger,
) {
}
@@ -68,7 +70,10 @@ class ParticipantController extends AbstractController
$bookingData = $this->dataLoader->fetchBookingData($bookingId, $user);
if (null === $bookingData || $bookingData instanceof Notification) {
$this->addFlash('error', 'Buchungsdaten nicht (mehr) verfügbar');
$this->logger->error('Unable to fetch booking data', [
'booking_id' => $bookingId,
]);
$this->addFlash('error', 'Die Buchungsdaten können aktuell nicht abgerufen werden. Bitte versuche es später oder wende dich an den Kundenservice.');
return $this->redirectToRoute('app_bookings');
}