|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony package. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
7 * |
|
8 * For the full copyright and license information, please view the LICENSE |
|
9 * file that was distributed with this source code. |
|
10 */ |
|
11 |
|
12 namespace Symfony\Bundle\FrameworkBundle; |
|
13 |
|
14 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass; |
|
15 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddValidatorInitializersPass; |
|
16 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass; |
|
17 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TemplatingPass; |
|
18 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RegisterKernelListenersPass; |
|
19 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RoutingResolverPass; |
|
20 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass; |
|
21 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass; |
|
22 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass; |
|
23 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ContainerBuilderDebugDumpPass; |
|
24 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CompilerDebugDumpPass; |
|
25 use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
26 use Symfony\Component\DependencyInjection\Compiler\PassConfig; |
|
27 use Symfony\Component\DependencyInjection\Scope; |
|
28 use Symfony\Component\HttpFoundation\Request; |
|
29 use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
30 |
|
31 /** |
|
32 * Bundle. |
|
33 * |
|
34 * @author Fabien Potencier <fabien@symfony.com> |
|
35 */ |
|
36 class FrameworkBundle extends Bundle |
|
37 { |
|
38 public function boot() |
|
39 { |
|
40 if ($this->container->getParameter('kernel.trust_proxy_headers')) { |
|
41 Request::trustProxyData(); |
|
42 } |
|
43 } |
|
44 |
|
45 public function build(ContainerBuilder $container) |
|
46 { |
|
47 parent::build($container); |
|
48 |
|
49 $container->addScope(new Scope('request')); |
|
50 |
|
51 $container->addCompilerPass(new RoutingResolverPass()); |
|
52 $container->addCompilerPass(new ProfilerPass()); |
|
53 $container->addCompilerPass(new RegisterKernelListenersPass(), PassConfig::TYPE_AFTER_REMOVING); |
|
54 $container->addCompilerPass(new TemplatingPass()); |
|
55 $container->addCompilerPass(new AddConstraintValidatorsPass()); |
|
56 $container->addCompilerPass(new AddValidatorInitializersPass()); |
|
57 $container->addCompilerPass(new FormPass()); |
|
58 $container->addCompilerPass(new TranslatorPass()); |
|
59 $container->addCompilerPass(new AddCacheWarmerPass()); |
|
60 |
|
61 if ($container->getParameter('kernel.debug')) { |
|
62 $container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING); |
|
63 $container->addCompilerPass(new CompilerDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING); |
|
64 } |
|
65 } |
|
66 } |