Api Platform conference
Register now
References ErrorListener
API Platform Conference
September 19-20, 2024 | Lille & online

The international conference on the API Platform Framework

API Platform Conference 2024: meet the best PHP, JavaScript and API experts

Learn more about the event, register for the conference, and get ready for two days of inspiration, ideas, and knowledge-sharing with our incredible lineup of renowned specialists and advocates.

Register now
Reference
C
Class

ApiPlatform\Symfony\EventListener\ErrorListener

This error listener extends the Symfony one in order to add the _api_operation attribute when the request is duplicated. It will later be used to retrieve the exceptionToStatus from the operation (ExceptionAction).

class ApiPlatform\Symfony\EventListener\ErrorListener extends Symfony\Component\HttpKernel\EventListener\ErrorListener implements Symfony\Component\EventDispatcher\EventSubscriberInterface
{
    protected duplicateRequest(Throwable $exception, Symfony\Component\HttpFoundation\Request $request): Symfony\Component\HttpFoundation\Request
    public __construct(null|object|array|string $controller, null|Psr\Log\LoggerInterface $logger, bool $debug, array<string, array> $exceptionsMapping)
    public logKernelException(Symfony\Component\HttpKernel\Event\ExceptionEvent $event): null
    public onKernelException(Symfony\Component\HttpKernel\Event\ExceptionEvent $event): null
    public removeCspHeader(Symfony\Component\HttpKernel\Event\ResponseEvent $event): null
    public onControllerArguments(Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent $event): null
    public getSubscribedEvents(): array
    protected logException(Throwable $exception, string $message, null|string $logLevel): null
}

Properties

controller

object|array|string $controller

logger

Psr\Log\LoggerInterface $logger

debug

bool $debug

exceptionsMapping

array&lt;string, array&gt; $exceptionsMapping

Methods

duplicateRequest

protected duplicateRequest(Throwable $exception, Symfony\Component\HttpFoundation\Request $request): Symfony\Component\HttpFoundation\Request

Parameters

exceptionThrowable
requestSymfony\Component\HttpFoundation\Request

Returns

Symfony\Component\HttpFoundation\Request

Made with love by

Les-Tilleuls.coop can help you design and develop your APIs and web projects, and train your teams in API Platform, Symfony, Next.js, Kubernetes and a wide range of other technologies.

Learn more

Copyright © 2023 Kévin Dunglas

Sponsored by Les-Tilleuls.coop