forked from schmittjoh/JMSSerializerBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JMSSerializerBundle.php
35 lines (28 loc) · 1.75 KB
/
JMSSerializerBundle.php
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
<?php
namespace JMS\SerializerBundle;
use JMS\SerializerBundle\DependencyInjection\Compiler\AdjustDecorationPass;
use JMS\SerializerBundle\DependencyInjection\Compiler\CustomHandlersPass;
use JMS\SerializerBundle\DependencyInjection\Compiler\DoctrinePass;
use JMS\SerializerBundle\DependencyInjection\Compiler\AssignVisitorsPass;
use JMS\SerializerBundle\DependencyInjection\Compiler\ExpressionFunctionProviderPass;
use JMS\SerializerBundle\DependencyInjection\Compiler\FormErrorHandlerTranslationDomainPass;
use JMS\SerializerBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
use JMS\SerializerBundle\DependencyInjection\Compiler\TwigExtensionPass;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class JMSSerializerBundle extends Bundle
{
public function build(ContainerBuilder $builder): void
{
$builder->addCompilerPass(new AssignVisitorsPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
// Should run before Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass
$builder->addCompilerPass(new TwigExtensionPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10);
$builder->addCompilerPass(new FormErrorHandlerTranslationDomainPass());
$builder->addCompilerPass(new ExpressionFunctionProviderPass());
$builder->addCompilerPass(new DoctrinePass());
$builder->addCompilerPass(new RegisterEventListenersAndSubscribersPass(), PassConfig::TYPE_OPTIMIZE);
$builder->addCompilerPass(new CustomHandlersPass(), PassConfig::TYPE_OPTIMIZE);
$builder->addCompilerPass(new AdjustDecorationPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -100);
}
}