feat: prevent booking flow without available rooms

This commit is contained in:
Björn Fromme
2026-03-16 11:59:10 +01:00
parent 82b47e314b
commit 7ce3bc18b2
5 changed files with 71 additions and 7 deletions
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Exception;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Exception thrown when attempting to create a booking but no rooms are available.
*
* This exception is used to prevent users from entering the booking flow
* when there are no available rooms for the selected travel dates.
*/
class NoRoomsAvailableException extends HttpException
{
public function __construct(int $dateId, int $hotelId, ?\Throwable $previous = null)
{
$message = sprintf(
'Leider sind für diese Reise aktuell keine Zimmer verfügbar (Travel ID: %d, Hotel ID: %d)',
$dateId,
$hotelId
);
parent::__construct(400, $message, $previous);
}
}