From 8dbccc7a8b0ed053144d93c66843b6c9c40580a8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 13 May 2011 10:31:22 +0200 Subject: [PATCH] [WebProfilerBundle] re-introduced parameters in the DIC for better overridability --- .../WebProfilerBundle/Controller/ProfilerController.php | 2 +- .../DependencyInjection/WebProfilerExtension.php | 6 ++---- .../Bundle/WebProfilerBundle/Resources/config/toolbar.xml | 8 ++++---- .../DependencyInjection/WebProfilerExtensionTest.php | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index fe30b4aeb408..493d3b448488 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -163,7 +163,7 @@ public function toolbarAction($token, $position = null) 'profiler' => $profiler, 'templates' => $this->getTemplates($profiler), 'profiler_url' => $url, - 'verbose' => $this->container->get('web_profiler.debug.toolbar')->getVerbose() + 'verbose' => $this->container->get('web_profiler.debug_toolbar')->getVerbose() )); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php index 77c81c8a9ef8..397e3f8927fb 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php +++ b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php @@ -47,10 +47,8 @@ public function load(array $configs, ContainerBuilder $container) $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('toolbar.xml'); - $container->getDefinition('web_profiler.debug.toolbar') - ->replaceArgument(1, $config['intercept_redirects']) - ->replaceArgument(2, $config['verbose']) - ; + $container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']); + $container->setParameter('web_profiler.debug_toolbar.verbose', $config['verbose']); } } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml index 0f83e8d37e76..de707f98bc07 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml @@ -5,15 +5,15 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - Symfony\Bundle\WebProfilerBundle\WebDebugToolbarListener + Symfony\Bundle\WebProfilerBundle\WebDebugToolbarListener - + - - + %web_profiler.debug_toolbar.intercept_redirects% + %web_profiler.debug_toolbar.verbose% diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php index 73c278235980..5e2a3dfe4744 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php @@ -80,7 +80,7 @@ public function testDefaultConfig($debug) $extension = new WebProfilerExtension(); $extension->load(array(array()), $this->container); - $this->assertFalse($this->container->has('web_profiler.debug.toolbar')); + $this->assertFalse($this->container->has('web_profiler.debug_toolbar')); $this->assertSaneContainer($this->getDumpedContainer()); } @@ -95,7 +95,7 @@ public function testToolbarConfig($debug) $extension = new WebProfilerExtension(); $extension->load(array(array('toolbar' => $debug)), $this->container); - $this->assertTrue($debug === $this->container->has('web_profiler.debug.toolbar'), '->load() registers web_profiler.debug.toolbar only when toolbar is true'); + $this->assertTrue($debug === $this->container->has('web_profiler.debug_toolbar'), '->load() registers web_profiler.debug_toolbar only when toolbar is true'); $this->assertSaneContainer($this->getDumpedContainer()); }