wip: finalize implementation

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent b882175f36
commit 5ef3bb9cbf
20 changed files with 112 additions and 224 deletions
@@ -5,7 +5,9 @@ declare(strict_types=1);
namespace App\Controller\Booking\Traits;
use App\Form\Model\BookingDto;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
/**
* Provides common functionality for booking creation controllers.
@@ -78,4 +80,20 @@ trait BookingCreateTrait
'groupedSelectedRooms' => $groupedSelectedRooms,
];
}
/**
* Handles API errors by logging, adding flash message, and rendering the form.
*/
private function handleApiError(
string $logMessage,
array $context,
string $flashMessage,
BookingDto $bookingCreateDto,
FormInterface $form,
): Response {
$this->logger->error($logMessage, $context);
$this->addFlash('error', $flashMessage);
return $this->renderStepForm($bookingCreateDto, $form);
}
}