feat: prevent booking flow without available rooms

This commit is contained in:
Björn Fromme
2025-09-24 11:14:45 +02:00
parent 5642193610
commit eed7ba4d7b
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);
}
}