wip: finalize implementation
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user