[WebBundle] made registration of templating debugging automatic without the use of the web.debug element

This commit is contained in:
Fabien Potencier 2010-02-24 16:19:42 +01:00
parent 987a36d936
commit 272959dc3d
2 changed files with 12 additions and 3 deletions

View File

@ -5,6 +5,8 @@ namespace Symfony\Framework\WebBundle;
use Symfony\Foundation\Bundle\Bundle as BaseBundle;
use Symfony\Components\DependencyInjection\ContainerInterface;
use Symfony\Components\DependencyInjection\Loader\Loader;
use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Components\DependencyInjection\BuilderConfiguration;
use Symfony\Framework\WebBundle\DependencyInjection\WebExtension;
/*
@ -34,5 +36,14 @@ class Bundle extends BaseBundle
$dirs[] = $dir.'/%%bundle%%/Resources/views/%%controller%%/%%name%%%%format%%.php';
}
$container->setParameter('templating.loader.filesystem.path', $dirs);
$configuration = new BuilderConfiguration();
if ($container->getParameter('kernel.debug'))
{
$loader = new XmlFileLoader(__DIR__.'/Resources/config');
$configuration->merge($loader->load('debug.xml'));
}
return $configuration;
}
}

View File

@ -151,11 +151,9 @@ class WebExtension extends LoaderExtension
{
$configuration = new BuilderConfiguration();
$loader = new XmlFileLoader(__DIR__.'/../Resources/config');
$configuration->merge($loader->load($this->resources['debug']));
if (isset($config['toolbar']) && $config['toolbar'])
{
$loader = new XmlFileLoader(__DIR__.'/../Resources/config');
$configuration->merge($loader->load('debug_data_collector.xml'));
$configuration->merge($loader->load('debug_web_debug_toolbar.xml'));
}