Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[WebProfilerBundle] re-introduced parameters in the DIC for better ov…
…erridability
  • Loading branch information
fabpot committed May 13, 2011
1 parent 4525eb9 commit 8dbccc7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
Expand Up @@ -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()
));
}

Expand Down
Expand Up @@ -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']);
}
}

Expand Down
Expand Up @@ -5,15 +5,15 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="web_profiler.debug.toolbar.class">Symfony\Bundle\WebProfilerBundle\WebDebugToolbarListener</parameter>
<parameter key="web_profiler.debug_toolbar.class">Symfony\Bundle\WebProfilerBundle\WebDebugToolbarListener</parameter>
</parameters>

<services>
<service id="web_profiler.debug.toolbar" class="%web_profiler.debug.toolbar.class%">
<service id="web_profiler.debug_toolbar" class="%web_profiler.debug_toolbar.class%">
<tag name="kernel.listener" event="onCoreResponse" priority="-128" />
<argument type="service" id="templating.engine.twig" />
<argument /> <!-- intercept_redirects -->
<argument /> <!-- verbose -->
<argument>%web_profiler.debug_toolbar.intercept_redirects%</argument>
<argument>%web_profiler.debug_toolbar.verbose%</argument>
</service>
</services>
</container>
Expand Up @@ -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());
}
Expand All @@ -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());
}
Expand Down

0 comments on commit 8dbccc7

Please sign in to comment.