28 lines
757 B
PHP
28 lines
757 B
PHP
<?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);
|
|
}
|
|
}
|