27 lines
719 B
PHP
27 lines
719 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Exception;
|
|
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
|
|
/**
|
|
* Exception thrown when attempting to load a hotel that exists but is not available for the specified travel.
|
|
*
|
|
* This exception is used when a hotel ID exists in the system but is not
|
|
* associated with the requested travel/date ID.
|
|
*/
|
|
class HotelNotInTravelException extends HttpException
|
|
{
|
|
public function __construct(int $dateId, int $hotelId, ?\Throwable $previous = null)
|
|
{
|
|
$message = sprintf(
|
|
'Hotel ID %d is not available for travel ID %d',
|
|
$hotelId,
|
|
$dateId
|
|
);
|
|
|
|
parent::__construct(404, $message, $previous);
|
|
}
|
|
} |