-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathservices.php
More file actions
45 lines (36 loc) · 1.59 KB
/
services.php
File metadata and controls
45 lines (36 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Phpro\ApiProblemBundle\EventListener\JsonApiProblemExceptionListener;
use Phpro\ApiProblemBundle\Transformer\ApiProblemExceptionTransformer;
use Phpro\ApiProblemBundle\Transformer\Chain;
use Phpro\ApiProblemBundle\Transformer\HttpExceptionTransformer;
use Phpro\ApiProblemBundle\Transformer\SecurityExceptionTransformer;
return static function (ContainerConfigurator $container): void {
$services = $container->services();
$services->set(JsonApiProblemExceptionListener::class)
->class(JsonApiProblemExceptionListener::class)
->args([
'$exceptionTransformer' => service(Chain::class),
'$debug' => param('kernel.debug'),
])
->tag('kernel.event_listener', [
'event' => 'kernel.exception',
'method' => 'onKernelException',
'priority' => -5,
]);
$services->set(Chain::class)
->class(Chain::class)
->args([
tagged_iterator('phpro.api_problem.exception_transformer'),
]);
$services->set(ApiProblemExceptionTransformer::class)
->class(ApiProblemExceptionTransformer::class)
->tag('phpro.api_problem.exception_transformer');
$services->set(HttpExceptionTransformer::class)
->class(HttpExceptionTransformer::class)
->tag('phpro.api_problem.exception_transformer');
$services->set(SecurityExceptionTransformer::class)
->class(SecurityExceptionTransformer::class)
->tag('phpro.api_problem.exception_transformer');
};