$dto->currentStep) { $this->addFlash('error', 'Bitte erst die vorherigen Schritte abschließen.'); return $this->redirectToCurrentStep($dto); } return null; } protected function createFailureResponse(\Throwable $exception, bool $htmx): Response { if ($htmx) { return new Response('', 400); } $message = $exception instanceof AccommodationSessionNotFoundException ? 'Deine Sitzung ist abgelaufen. Bitte starte die Anfrage erneut.' : 'Die Anfrage konnte nicht geladen werden.'; $this->addFlash('error', $message); return $this->redirectToRoute('app_groups_booking_error'); } private function redirectToCurrentStep(AccommodationBookingDto $dto): RedirectResponse { $route = match ($dto->currentStep) { 2 => 'app_groups_booking_step_2', 3 => 'app_groups_booking_step_3', 4 => 'app_groups_booking_step_4', default => 'app_groups_booking_step_1', }; return $this->redirectToRoute($route); } }