Skip to content

Commit

Permalink
fixed toolbar setting when overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 15, 2010
1 parent 1405db4 commit 25c4ff3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/Symfony/Components/DependencyInjection/Definition.php
Expand Up @@ -217,6 +217,18 @@ public function addAnnotation($name, array $attributes = array())
return $this;
}

/**
* Clears the annotation for this definition.
*
* @return Definition The current instance
*/
public function clearAnnotations()
{
$this->annotations = array();

return $this;
}

/**
* Sets a file to require before creating the service.
*
Expand Down
Expand Up @@ -31,9 +31,15 @@ public function configLoad($config, BuilderConfiguration $configuration)
$configuration->merge($loader->load('collectors.xml'));
}

if (isset($config['toolbar']) && $config['toolbar'] && !$configuration->hasDefinition('debug.toolbar')) {
$loader = new XmlFileLoader(__DIR__.'/../Resources/config');
$configuration->merge($loader->load('toolbar.xml'));
if (isset($config['toolbar'])) {
if ($config['toolbar']) {
if (!$configuration->hasDefinition('debug.toolbar')) {
$loader = new XmlFileLoader(__DIR__.'/../Resources/config');
$configuration->merge($loader->load('toolbar.xml'));
}
} else {
$configuration->getDefinition('debug.toolbar')->clearAnnotations();
}
}

return $configuration;
Expand Down

0 comments on commit 25c4ff3

Please sign in to comment.