feat: prevent booking flow without available rooms
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user