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;
|
2013-09-06 09:47:41 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass;
|
2016-03-04 17:43:16 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass;
|
2016-03-25 09:46:04 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ControllerArgumentValueResolverPass;
|
2011-04-22 16:41:21 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
|
2015-09-28 12:22:50 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\PropertyInfoPass;
|
2011-01-13 13:58:17 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TemplatingPass;
|
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;
|
2014-05-10 23:14:12 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\LoggingTranslatorPass;
|
2011-01-24 10:16:22 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass;
|
2011-12-12 22:39:17 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass;
|
2014-09-25 16:27:00 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddExpressionLanguageProvidersPass;
|
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;
|
2011-08-29 18:22:52 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationExtractorPass;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass;
|
2013-01-20 18:39:49 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
|
2014-10-29 09:15:52 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass;
|
2015-09-09 12:50:25 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass;
|
2014-10-02 16:46:44 +01:00
|
|
|
use Symfony\Component\Debug\ErrorHandler;
|
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;
|
2013-12-16 17:44:05 +00:00
|
|
|
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
|
2015-01-10 22:10:57 +00:00
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass;
|
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()
|
|
|
|
{
|
2014-10-27 13:40:25 +00:00
|
|
|
ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
|
2014-10-02 16:46:44 +01:00
|
|
|
|
2012-12-06 12:06:01 +00:00
|
|
|
if ($trustedProxies = $this->container->getParameter('kernel.trusted_proxies')) {
|
|
|
|
Request::setTrustedProxies($trustedProxies);
|
2011-07-05 18:38:29 +01:00
|
|
|
}
|
2013-02-27 13:12:14 +00:00
|
|
|
|
|
|
|
if ($this->container->getParameter('kernel.http_method_override')) {
|
|
|
|
Request::enableHttpMethodParameterOverride();
|
|
|
|
}
|
2013-08-06 08:14:49 +01:00
|
|
|
|
|
|
|
if ($trustedHosts = $this->container->getParameter('kernel.trusted_hosts')) {
|
|
|
|
Request::setTrustedHosts($trustedHosts);
|
|
|
|
}
|
2011-07-05 18:38:29 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-12-23 11:32:51 +00:00
|
|
|
$container->addCompilerPass(new RoutingResolverPass());
|
2010-12-23 11:48:45 +00:00
|
|
|
$container->addCompilerPass(new ProfilerPass());
|
2013-09-12 13:08:32 +01:00
|
|
|
// must be registered before removing private services as some might be listeners/subscribers
|
|
|
|
// but as late as possible to get resolved parameters
|
2013-09-12 13:57:47 +01:00
|
|
|
$container->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_BEFORE_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());
|
2013-09-06 09:47:41 +01:00
|
|
|
$container->addCompilerPass(new AddConsoleCommandPass());
|
2011-04-22 16:41:21 +01:00
|
|
|
$container->addCompilerPass(new FormPass());
|
2011-01-17 10:29:38 +00:00
|
|
|
$container->addCompilerPass(new TranslatorPass());
|
2014-05-10 23:14:12 +01:00
|
|
|
$container->addCompilerPass(new LoggingTranslatorPass());
|
2011-01-24 10:16:22 +00:00
|
|
|
$container->addCompilerPass(new AddCacheWarmerPass());
|
2011-12-12 22:39:17 +00:00
|
|
|
$container->addCompilerPass(new AddCacheClearerPass());
|
2014-09-25 16:27:00 +01:00
|
|
|
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());
|
2011-08-29 18:22:52 +01:00
|
|
|
$container->addCompilerPass(new TranslationExtractorPass());
|
|
|
|
$container->addCompilerPass(new TranslationDumperPass());
|
2013-01-31 09:37:27 +00:00
|
|
|
$container->addCompilerPass(new FragmentRendererPass(), PassConfig::TYPE_AFTER_REMOVING);
|
2013-01-20 18:39:49 +00:00
|
|
|
$container->addCompilerPass(new SerializerPass());
|
2015-09-28 12:22:50 +01:00
|
|
|
$container->addCompilerPass(new PropertyInfoPass());
|
2016-03-25 09:46:04 +00:00
|
|
|
$container->addCompilerPass(new ControllerArgumentValueResolverPass());
|
2016-03-04 17:43:16 +00:00
|
|
|
$container->addCompilerPass(new CachePoolPass());
|
2011-04-15 09:14:13 +01:00
|
|
|
|
|
|
|
if ($container->getParameter('kernel.debug')) {
|
2015-09-28 12:00:47 +01:00
|
|
|
$container->addCompilerPass(new UnusedTagsPass(), PassConfig::TYPE_AFTER_REMOVING);
|
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);
|
2015-09-09 12:50:25 +01:00
|
|
|
$container->addCompilerPass(new ConfigCachePass());
|
2011-04-15 09:14:13 +01:00
|
|
|
}
|
2010-12-20 19:56:14 +00:00
|
|
|
}
|
2010-02-17 13:55:05 +00:00
|
|
|
}
|