Ver Fonte

[DependencyInjection] added the extension files in the list of loaded resources

Fabien Potencier há 15 anos atrás
pai
commit
5d8529740a

+ 3 - 0
src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php

@@ -343,6 +343,9 @@ EOF
       $values = static::convertDomElementToArray($node);
       $config = $this->getExtension($node->namespaceURI)->load($node->localName, is_array($values) ? $values : array($values));
 
+      $r = new \ReflectionObject($this->getExtension($node->namespaceURI));
+      $config->addResource(new FileResource($r->getFileName()));
+
       $configuration->merge($config);
     }
   }

+ 9 - 4
src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php

@@ -253,7 +253,7 @@ class YamlFileLoader extends FileLoader
 
   protected function loadFromExtensions(BuilderConfiguration $configuration, $content)
   {
-    foreach ($content as $key => $config)
+    foreach ($content as $key => $values)
     {
       if (in_array($key, array('imports', 'parameters', 'services')))
       {
@@ -262,12 +262,17 @@ class YamlFileLoader extends FileLoader
 
       list($namespace, $tag) = explode('.', $key);
 
-      if (!is_array($config))
+      if (!is_array($values))
       {
-        $config = array();
+        $values = array();
       }
 
-      $configuration->merge(static::getExtension($namespace)->load($tag, $config));
+      $config = static::getExtension($namespace)->load($tag, $values);
+
+      $r = new \ReflectionObject($this->getExtension($namespace));
+      $config->addResource(new FileResource($r->getFileName()));
+
+      $configuration->merge($config);
     }
   }
 }