2010-02-17 13:55:05 +00:00
|
|
|
<?php
|
|
|
|
|
2011-01-15 13:29:43 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2011-01-15 13:29:43 +00:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2010-07-09 09:05:26 +01:00
|
|
|
namespace Symfony\Bundle\FrameworkBundle;
|
2010-02-17 13:55:05 +00:00
|
|
|
|
2011-01-05 19:53:38 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass;
|
2011-07-06 11:34:41 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddValidatorInitializersPass;
|
2011-04-22 16:41:21 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
|
2011-01-13 13:58:17 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TemplatingPass;
|
2011-01-05 11:13:27 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RegisterKernelListenersPass;
|
2010-12-23 11:32:51 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RoutingResolverPass;
|
2010-12-23 11:48:45 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
|
2011-01-17 10:29:38 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass;
|
2011-01-24 10:16:22 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass;
|
2011-03-10 15:09:40 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ContainerBuilderDebugDumpPass;
|
2011-04-14 20:04:45 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CompilerDebugDumpPass;
|
2010-12-20 19:56:14 +00:00
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
2011-01-16 09:17:38 +00:00
|
|
|
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
2011-02-13 09:33:53 +00:00
|
|
|
use Symfony\Component\DependencyInjection\Scope;
|
2011-07-05 18:38:29 +01:00
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
2010-09-15 19:49:16 +01:00
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
2010-02-17 13:55:05 +00:00
|
|
|
|
|
|
|
/**
|
2010-04-07 01:51:29 +01:00
|
|
|
* Bundle.
|
2010-02-17 13:55:05 +00:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
2010-02-17 13:55:05 +00:00
|
|
|
*/
|
2010-07-09 09:05:26 +01:00
|
|
|
class FrameworkBundle extends Bundle
|
2010-02-17 13:55:05 +00:00
|
|
|
{
|
2011-07-05 18:38:29 +01:00
|
|
|
public function boot()
|
|
|
|
{
|
2011-07-06 16:42:58 +01:00
|
|
|
if ($this->container->getParameter('kernel.trust_proxy_headers')) {
|
2011-07-05 18:38:29 +01:00
|
|
|
Request::trustProxyData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-15 03:47:19 +00:00
|
|
|
public function build(ContainerBuilder $container)
|
2010-12-20 19:56:14 +00:00
|
|
|
{
|
2011-02-15 03:47:19 +00:00
|
|
|
parent::build($container);
|
2010-12-20 19:56:14 +00:00
|
|
|
|
2011-02-13 09:33:53 +00:00
|
|
|
$container->addScope(new Scope('request'));
|
2011-01-17 22:28:59 +00:00
|
|
|
|
2010-12-23 11:32:51 +00:00
|
|
|
$container->addCompilerPass(new RoutingResolverPass());
|
2010-12-23 11:48:45 +00:00
|
|
|
$container->addCompilerPass(new ProfilerPass());
|
2011-07-21 18:19:30 +01:00
|
|
|
$container->addCompilerPass(new RegisterKernelListenersPass(), PassConfig::TYPE_AFTER_REMOVING);
|
2011-01-13 13:58:17 +00:00
|
|
|
$container->addCompilerPass(new TemplatingPass());
|
2011-01-05 19:53:38 +00:00
|
|
|
$container->addCompilerPass(new AddConstraintValidatorsPass());
|
2011-07-06 11:34:41 +01:00
|
|
|
$container->addCompilerPass(new AddValidatorInitializersPass());
|
2011-04-22 16:41:21 +01:00
|
|
|
$container->addCompilerPass(new FormPass());
|
2011-01-17 10:29:38 +00:00
|
|
|
$container->addCompilerPass(new TranslatorPass());
|
2011-01-24 10:16:22 +00:00
|
|
|
$container->addCompilerPass(new AddCacheWarmerPass());
|
2011-04-15 09:14:13 +01:00
|
|
|
|
|
|
|
if ($container->getParameter('kernel.debug')) {
|
2011-05-01 16:18:30 +01:00
|
|
|
$container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING);
|
2011-04-15 09:14:13 +01:00
|
|
|
$container->addCompilerPass(new CompilerDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING);
|
|
|
|
}
|
2010-12-20 19:56:14 +00:00
|
|
|
}
|
2010-02-17 13:55:05 +00:00
|
|
|
}
|