PHP Класс ApiPlatform\Core\Action\ExceptionAction
Usage:
$exceptionAction = new ExceptionAction(
new Serializer(),
[
'jsonproblem' => ['application/problem+json'],
'jsonld' => ['application/ld+json'],
],
[
ExceptionInterface::class => Response::HTTP_BAD_REQUEST,
InvalidArgumentException::class => Response::HTTP_BAD_REQUEST,
]
);
Показать файл
Открыть проект
Открытые методы
Метод |
Описание |
|
__construct ( Symfony\Component\Serializer\SerializerInterface $serializer, array $errorFormats, array $exceptionToStatus = [] ) |
|
|
__invoke ( FlattenException $exception, Request $request ) : Response |
Converts a an exception to a JSON response. |
|
Описание методов
__construct()
публичный метод
public __construct ( Symfony\Component\Serializer\SerializerInterface $serializer, array $errorFormats, array $exceptionToStatus = [] ) |
$serializer |
Symfony\Component\Serializer\SerializerInterface |
|
$errorFormats |
array |
A list of enabled formats, the first one will be the default |
$exceptionToStatus |
array |
A list of exceptions mapped to their HTTP status code |
__invoke()
публичный метод
Converts a an exception to a JSON response.
public __invoke ( FlattenException $exception, Request $request ) : Response |
$exception |
Symfony\Component\Debug\Exception\FlattenException |
|
$request |
Symfony\Component\HttpFoundation\Request |
|
Результат |
Symfony\Component\HttpFoundation\Response |
|