ソースを参照

fixed toolbar setting when overridden

Fabien Potencier 15 年 前
コミット
25c4ff3b9c

+ 12 - 0
src/Symfony/Components/DependencyInjection/Definition.php

@@ -217,6 +217,18 @@ class Definition
         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.
      *

+ 9 - 3
src/Symfony/Framework/ProfilerBundle/DependencyInjection/ProfilerExtension.php

@@ -31,9 +31,15 @@ class ProfilerExtension extends LoaderExtension
             $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;