Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Extension load #589

Closed
wants to merge 3 commits into from

7 participants

Lukas Kahwe Smith John Wards Jeremy Mikola Fabien Potencier Johannes Sören Rohweder Ryan Weaver
Lukas Kahwe Smith

tag is no longer necessary, doctrine etc needs a new layer in the configs to separate dbal from orm:
app:
charset: UTF-8
error_handler: null
csrf_protection:
enabled: true
secret: xxxxxxxxxx
router: { resource: "%kernel.root_dir%/config/routing.yml" }
validation: { enabled: true, annotations: true }
templating: { engines: ['twig', 'php'] } #assets_version: SomeVersionScheme
session:
default_locale: en
lifetime: 3600
auto_start: true

# Twig Configuration
twig:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%

## Doctrine Configuration
doctrine:
    dbal:
      dbname:   test
      driver:   pdo_sqlite
      path:     %kernel.root_dir%/app.db
      logging:  %kernel.debug%

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        mappings:
            HelloBundle: ~
            FOSUserBundle: ~
added some commits
Lukas Kahwe Smith implicitly load all registered bundles, all loading is now handled by…
… load(), disable loading of an extension explcitly via setting the extension config to false (for now only Yaml is implemented)
e47336e
Lukas Kahwe Smith only call load() if its actually callable 6d05039
Lukas Kahwe Smith also made things work for Xml 63a3371
John Wards

From a newbie to Symfony2, this change makes the config.yml's make much more sense.

Jeremy Mikola

There were some concerns in IRC this weekend that this change might break XML; however, Lukas proposed adding a common "config" tag in the appropriate namespace to wrap the now-second-level options that were formerly top-level tags.

<doctrine:config>
    <doctrine:orm />
    <doctrine:dbal />
</doctrine:config>

And <doctrine:config /> would be pointless, as would "doctrine: ~" in YAML, since bundles are implicitly configured just by being enabled.

So this change would require adjustments to each bundle's XSD (to add a top-level wrapping tag), but I don't see a problem.

Lukas Kahwe Smith

furthermore if a user would forget the configure doctrine, but enables it .. he would not get a proper error message telling him that he has enabled but not configured doctrine, which is of course pointless.

Lukas Kahwe Smith

btw .. i assume the XSD's would now also need to be updated, which i havent done yet ..

Fabien Potencier
Owner

Does it make sense to go one step further and only allow one extension per bundle?

If yes, why not trying to standardize the alias/namespace to the bundle name then. For instance, for FrameworkBundle, the alias would be 'framework'. For SensioBlogBundle, 'sensio_blog', ... If we do that, we will also be able to have better exception messages like "The 'SensioBlogBundle' is not enabled, but you defined settings for it under 'sensio_blog'".

Lukas Kahwe Smith

Sure.

Johannes

I'm not sure whether any of this is really necessary, it seems only to take away flexibility.

I don't think that you will have that many third party bundles where you don't have anything to configure. Naturally, since you didn't write the bundle, you most likely have to make at least some kind of configuration for it to be usable. And for app bundles which you did write, you can simply import the services.xml (@SomeBundle/Resources/services.xml) into your app config.

How about improving the installation process of bundles (which we don't have yet) to improve the user experience?

Lukas Kahwe Smith

Actually about half of my Bundles do not need any config. Furthermore right now if you add a Bundle into the kernel, there is no clear error message if that Bundle requires configuration (like the Doctrine bundle). With this change we could provide a very clear error message with instructions on the next step.

Johannes

Are these bundles third-party bundles or app bundles (written by yourself)? For app bundles, there shouldn't be a need for an Extension at all.

I think if we install a default configuration when a bundle is installed, it is much more helpful for the user than an implicit loading of the Extension. The default configuration could ship with comments and serve as a form of documentation. Similar to when you install a Debian package, you also get a default configuration where you can comment lines out, comment them in, etc.

Lukas Kahwe Smith

these are mostly app bundles. and yes there is a need for extensions for those, because they all define their own services, for controllers, for helpers etc. and many of those are indeed configurable, but always and not in all scenarios. trying to add yet another approach for configuration will just increase confusion.

as for flexibility. what is really lost? you can still pass multiple config arrays to a single load method, which can then load up any other class, split things up in multiple methods etc. so multiple extensions and extension load methods is just syntax sugar, that for the edge cases where you need it you can just implement inside the given bundle's load() method.

Johannes

The question is what are the benefits of this, and is it the best way to get them?

The benefit is not having to write "namespace.tag: ~", right? So, what I'm proposing would get you this benefit plus better documentation for actually configuring the bundle by installing a default config with inline comments. Right now, we do not have an automated installation process at all, so I'm not sure if this patch is not solving a problem that should rather be solved by such an installation process.

Lukas Kahwe Smith

what you are proposing is yet another way to do configuration instead of making the current approach easier to use.

also the special meaning of the tag is usually hard for beginners to grasp.

finally with that fabien was suggesting it also does away with the issue of non unique alias names.

Sören Rohweder

+1, good idea to get rid of empty extension.config: ~
and also the understanding for newbies would be better,I think

Ryan Weaver

I'm also behind this. If we don't do this, we'll get questions daily from users that enable a bundle and then complain that the bundle doesn't work. This is a very pragmatic approach and, as Lukas points out, the error you receive when you forget to include the bundle configuration is very poor.

I'd also second Fabien's idea to enforce one extension per bundle and rename the existing aliases to something directly related to the bundle name.

These changes will make bundles and configuration less mystifying and troublesome for users, and I don't see much "cost" to the change. I'm really hoping we can make this work.

Thanks!

Johannes

I'm not generally against this. All I'm saying is that we should probably wait until the bundle installation/distribution system that currently is being worked on is in place, and then revisit if we still need this change, or if it can be handled better there.

Having a default configuration installed automatically would also go more into the direction of good documentation, and you wouldn't have to copy/paste anymore.

Lukas Kahwe Smith

i dont think there is much sense in waiting. first up the distribution system is a big change and i am not 100% we will be able to deliver it for RC1, nor do i personally think its critical for a 2.0.

but more importantly i do not see how the proposed changes would become irrelevant. actually this is a simplification that will make whatever tools we might come up with to install + activate bundles easier. so this is all more a reason to do it now, rather than later.

Fabien Potencier
Owner

@lsmith77: At first glance, the tests do not pass. Can you check that before I work on the other changes we've talked about in this discussion? Thanks.

Lukas Kahwe Smith

yeah .. i didnt update the tests at all. will work on that tomorrow before lunch, unless someone else steps in beforehand :)

Fabien Potencier
Owner

@lsmith77: nevermind, I'm working on it right now, and with the other changes, it will be much easier for me to do evrything.

Fabien Potencier
Owner

ok, I've fixed everything. I will now update the doc and the sandbox and merge.

Fabien Potencier
Owner

merged.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 3 unique commits by 1 author.

Feb 05, 2011
Lukas Kahwe Smith implicitly load all registered bundles, all loading is now handled by…
… load(), disable loading of an extension explcitly via setting the extension config to false (for now only Yaml is implemented)
e47336e
Lukas Kahwe Smith only call load() if its actually callable 6d05039
Lukas Kahwe Smith also made things work for Xml 63a3371
This page is out of date. Refresh to see the latest.

Showing 15 changed files with 91 additions and 80 deletions. Show diff stats Hide diff stats

  1. 26  src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php
  2. 5  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddClassesToAutoloadMapPass.php
  3. 5  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddClassesToCachePass.php
  4. 2  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
  5. 14  src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
  6. 2  src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php
  7. 2  src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
  8. 2  src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php
  9. 2  src/Symfony/Bundle/ZendBundle/DependencyInjection/ZendExtension.php
  10. 16  src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php
  11. 46  src/Symfony/Component/DependencyInjection/ContainerBuilder.php
  12. 18  src/Symfony/Component/DependencyInjection/Extension/Extension.php
  13. 5  src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php
  14. 2  src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
  15. 24  src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
26  src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php
@@ -29,6 +29,28 @@
29 29
  */
30 30
 class DoctrineExtension extends AbstractDoctrineExtension
31 31
 {
  32
+    public function load(array $configs, ContainerBuilder $container)
  33
+    {
  34
+        $dbal = $orm = array();
  35
+        foreach ($configs as $config) {
  36
+            if (isset($config['dbal'])) {
  37
+                $dbal[] = $config['dbal'];
  38
+            }
  39
+
  40
+            if (isset($config['orm'])) {
  41
+                $orm[] = $config['orm'];
  42
+            }
  43
+        }
  44
+
  45
+        if (!empty($dbal)) {
  46
+            $this->dbalLoad($dbal, $container);
  47
+        }
  48
+
  49
+        if (!empty($orm)) {
  50
+            $this->ormLoad($orm, $container);
  51
+        }
  52
+    }
  53
+
32 54
     /**
33 55
      * Loads the DBAL configuration.
34 56
      *
@@ -39,7 +61,7 @@ class DoctrineExtension extends AbstractDoctrineExtension
39 61
      * @param array $config An array of configuration settings
40 62
      * @param ContainerBuilder $container A ContainerBuilder instance
41 63
      */
42  
-    public function dbalLoad(array $configs, ContainerBuilder $container)
  64
+    protected function dbalLoad(array $configs, ContainerBuilder $container)
43 65
     {
44 66
         $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
45 67
         $loader->load('dbal.xml');
@@ -229,7 +251,7 @@ protected function loadDbalConnection(array $connection, ContainerBuilder $conta
229 251
      * @param array $config An array of configuration settings
230 252
      * @param ContainerBuilder $container A ContainerBuilder instance
231 253
      */
232  
-    public function ormLoad(array $configs, ContainerBuilder $container)
  254
+    protected function ormLoad(array $configs, ContainerBuilder $container)
233 255
     {
234 256
         $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
235 257
         $loader->load('orm.xml');
5  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddClassesToAutoloadMapPass.php
@@ -28,10 +28,7 @@ class AddClassesToAutoloadMapPass implements CompilerPassInterface
28 28
     public function process(ContainerBuilder $container)
29 29
     {
30 30
         $classes = array();
31  
-        foreach ($container->getExtensionConfigs() as $name => $configs) {
32  
-            list($namespace, $tag) = explode(':', $name);
33  
-
34  
-            $extension = $container->getExtension($namespace);
  31
+        foreach ($container->getExtensions() as $extension) {
35 32
             if ($extension instanceof Extension) {
36 33
                 $classes = array_merge($classes, $extension->getAutoloadClassMap());
37 34
             }
5  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddClassesToCachePass.php
@@ -28,10 +28,7 @@ class AddClassesToCachePass implements CompilerPassInterface
28 28
     public function process(ContainerBuilder $container)
29 29
     {
30 30
         $classes = array();
31  
-        foreach ($container->getExtensionConfigs() as $name => $configs) {
32  
-            list($namespace, $tag) = explode(':', $name);
33  
-
34  
-            $extension = $container->getExtension($namespace);
  31
+        foreach ($container->getExtensions() as $extension) {
35 32
             if ($extension instanceof Extension) {
36 33
                 $classes = array_merge($classes, $extension->getClassesToCompile());
37 34
             }
2  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -29,7 +29,7 @@
29 29
  */
30 30
 class FrameworkExtension extends Extension
31 31
 {
32  
-    public function configLoad(array $configs, ContainerBuilder $container)
  32
+    public function load(array $configs, ContainerBuilder $container)
33 33
     {
34 34
         foreach ($configs as $config) {
35 35
             $this->doConfigLoad($config, $container);
14  src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -35,17 +35,15 @@ class SecurityExtension extends Extension
35 35
     protected $contextListeners = array();
36 36
     protected $listenerPositions = array('pre_auth', 'form', 'http', 'remember_me');
37 37
 
38  
-    public function configLoad(array $configs, ContainerBuilder $container)
  38
+    public function load(array $configs, ContainerBuilder $container)
39 39
     {
40 40
         foreach ($configs as $config) {
41  
-            $this->doConfigLoad($this->normalizeKeys($config), $container);
42  
-        }
43  
-    }
  41
+            if (isset($config['acl'])) {
  42
+                $this->doAclLoad($this->normalizeKeys($config['acl']), $container);
  43
+                unset($config['acl']);
  44
+            }
44 45
 
45  
-    public function aclLoad(array $configs, ContainerBuilder $container)
46  
-    {
47  
-        foreach ($configs as $config) {
48  
-            $this->doAclLoad($this->normalizeKeys($config), $container);
  46
+            $this->doConfigLoad($this->normalizeKeys($config), $container);
49 47
         }
50 48
     }
51 49
 
2  src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php
@@ -23,7 +23,7 @@
23 23
  */
24 24
 class SwiftMailerExtension extends Extension
25 25
 {
26  
-    public function configLoad(array $configs, ContainerBuilder $container)
  26
+    public function load(array $configs, ContainerBuilder $container)
27 27
     {
28 28
         foreach ($configs as $config) {
29 29
             $this->doConfigLoad($config, $container);
2  src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
@@ -23,7 +23,7 @@
23 23
  */
24 24
 class TwigExtension extends Extension
25 25
 {
26  
-    public function configLoad(array $configs, ContainerBuilder $container)
  26
+    public function load(array $configs, ContainerBuilder $container)
27 27
     {
28 28
         $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
29 29
         $loader->load('twig.xml');
2  src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php
@@ -32,7 +32,7 @@
32 32
  */
33 33
 class WebProfilerExtension extends Extension
34 34
 {
35  
-    public function configLoad(array $configs, ContainerBuilder $container)
  35
+    public function load(array $configs, ContainerBuilder $container)
36 36
     {
37 37
         foreach ($configs as $config) {
38 38
             $this->doConfigLoad($config, $container);
2  src/Symfony/Bundle/ZendBundle/DependencyInjection/ZendExtension.php
@@ -34,7 +34,7 @@ class ZendExtension extends Extension
34 34
      * @param array            $config    An array of configuration settings
35 35
      * @param ContainerBuilder $container A ContainerBuilder instance
36 36
      */
37  
-    public function configLoad(array $configs, ContainerBuilder $container)
  37
+    public function load(array $configs, ContainerBuilder $container)
38 38
     {
39 39
         $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
40 40
         $loader->load('logger.xml');
16  src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php
@@ -29,17 +29,17 @@ public function process(ContainerBuilder $container)
29 29
         $definitions = $container->getDefinitions();
30 30
         $aliases = $container->getAliases();
31 31
 
32  
-        foreach ($container->getExtensionConfigs() as $name => $configs) {
33  
-            list($namespace, $tag) = explode(':', $name);
  32
+        foreach ($container->getExtensions() as $alias => $extension) {
34 33
 
35  
-            $extension = $container->getExtension($namespace);
  34
+            $configs = $container->getExtensionConfig($alias);
  35
+            if ($configs !== false && method_exists($extension, 'load')) {
  36
+                $tmpContainer = new ContainerBuilder($container->getParameterBag());
  37
+                $tmpContainer->addObjectResource($extension);
36 38
 
37  
-            $tmpContainer = new ContainerBuilder($container->getParameterBag());
38  
-            $tmpContainer->addObjectResource($extension);
  39
+                $extension->load($configs, $tmpContainer);
39 40
 
40  
-            $extension->load($tag, $configs, $tmpContainer);
41  
-
42  
-            $container->merge($tmpContainer);
  41
+                $container->merge($tmpContainer);
  42
+            }
43 43
         }
44 44
 
45 45
         $container->addDefinitions($definitions);
46  src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -28,6 +28,7 @@
28 28
 class ContainerBuilder extends Container implements TaggedContainerInterface
29 29
 {
30 30
     static protected $extensions = array();
  31
+    static protected $extensionsByNs = array();
31 32
 
32 33
     protected $definitions      = array();
33 34
     protected $aliases          = array();
@@ -53,7 +54,7 @@ public function __construct(ParameterBagInterface $parameterBag = null)
53 54
      */
54 55
     static public function registerExtension(ExtensionInterface $extension)
55 56
     {
56  
-        static::$extensions[$extension->getAlias()] = static::$extensions[$extension->getNamespace()] = $extension;
  57
+        static::$extensions[$extension->getAlias()] = static::$extensionsByNs[$extension->getNamespace()] = $extension;
57 58
     }
58 59
 
59 60
     /**
@@ -65,16 +66,30 @@ static public function registerExtension(ExtensionInterface $extension)
65 66
      */
66 67
     static public function getExtension($name)
67 68
     {
68  
-        if (!isset(static::$extensions[$name])) {
69  
-            throw new \LogicException(sprintf('Container extension "%s" is not registered', $name));
  69
+        if (empty(static::$extensions[$name])) {
  70
+            if (empty(static::$extensionsByNs[$name])) {
  71
+                throw new \LogicException(sprintf('Container extension "%s" is not registered', $name));
  72
+            }
  73
+
  74
+            return static::$extensionsByNs[$name];
70 75
         }
71 76
 
72 77
         return static::$extensions[$name];
73 78
     }
74 79
 
  80
+    /**
  81
+     * Returns extensions keyed by alias
  82
+     *
  83
+     * @return array ExtensionInterfaces
  84
+     */
  85
+    static public function getExtensions()
  86
+    {
  87
+        return static::$extensions;
  88
+    }
  89
+
75 90
     static public function hasExtension($name)
76 91
     {
77  
-        return isset(static::$extensions[$name]);
  92
+        return isset(static::$extensions[$name]) || isset(static::$extensionsByNs[$name]);
78 93
     }
79 94
 
80 95
     /**
@@ -118,12 +133,11 @@ public function addObjectResource($object)
118 133
      * Loads the configuration for an extension.
119 134
      *
120 135
      * @param string $extension The extension alias or namespace
121  
-     * @param string $tag       The extension tag to load (without the namespace - namespace.tag)
122 136
      * @param array  $values    An array of values that customizes the extension
123 137
      *
124 138
      * @return ContainerBuilder The current instance
125 139
      */
126  
-    public function loadFromExtension($extension, $tag, array $values = array())
  140
+    public function loadFromExtension($extension, array $values = array())
127 141
     {
128 142
         if (true === $this->isFrozen()) {
129 143
             throw new \LogicException('Cannot load from an extension on a frozen container.');
@@ -131,11 +145,11 @@ public function loadFromExtension($extension, $tag, array $values = array())
131 145
 
132 146
         $namespace = $this->getExtension($extension)->getAlias();
133 147
 
134  
-        if (!isset($this->extensionConfigs[$namespace.':'.$tag])) {
135  
-            $this->extensionConfigs[$namespace.':'.$tag] = array();
  148
+        if (!isset($this->extensionConfigs[$namespace])) {
  149
+            $this->extensionConfigs[$namespace] = array();
136 150
         }
137 151
 
138  
-        $this->extensionConfigs[$namespace.':'.$tag][] = $this->getParameterBag()->resolveValue($values);
  152
+        $this->extensionConfigs[$namespace][] = $this->getParameterBag()->resolveValue($values);
139 153
 
140 154
         return $this;
141 155
     }
@@ -341,6 +355,20 @@ public function getExtensionConfigs()
341 355
     }
342 356
 
343 357
     /**
  358
+     * Returns the containers for the registered extensions by alias.
  359
+     *
  360
+     * @return ExtensionInterface extension container
  361
+     */
  362
+    public function getExtensionConfig($name)
  363
+    {
  364
+        if (empty($this->extensionConfigs[$name])) {
  365
+            return array(array());
  366
+        }
  367
+
  368
+        return $this->extensionConfigs[$name];
  369
+    }
  370
+
  371
+    /**
344 372
      * Sets the extension configs array
345 373
      *
346 374
      * @param array $config
18  src/Symfony/Component/DependencyInjection/Extension/Extension.php
@@ -21,24 +21,6 @@
21 21
 abstract class Extension implements ExtensionInterface
22 22
 {
23 23
     /**
24  
-     * Loads a specific configuration.
25  
-     *
26  
-     * @param string  $tag           The tag name
27  
-     * @param array   $config        An array of configuration values
28  
-     * @param ContainerBuilder $configuration A ContainerBuilder instance
29  
-     *
30  
-     * @throws \InvalidArgumentException When provided tag is not defined in this extension
31  
-     */
32  
-    public function load($tag, array $config, ContainerBuilder $configuration)
33  
-    {
34  
-        if (!method_exists($this, $method = $tag.'Load')) {
35  
-            throw new \InvalidArgumentException(sprintf('The tag "%s:%s" is not defined in the "%s" extension.', $this->getAlias(), $tag, $this->getAlias()));
36  
-        }
37  
-
38  
-        $this->$method($config, $configuration);
39  
-    }
40  
-
41  
-    /**
42 24
      * This method normalizes keys between the different configuration formats
43 25
      *
44 26
      * Namely, you mostly have foo_bar in YAML while you have foo-bar in XML.
5  src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php
@@ -23,15 +23,12 @@
23 23
     /**
24 24
      * Loads a specific configuration.
25 25
      *
26  
-     * @param string  $tag           The tag name
27 26
      * @param array   $config        An array of configuration values
28 27
      * @param ContainerBuilder $configuration A ContainerBuilder instance
29 28
      *
30  
-     * @return ContainerBuilder A ContainerBuilder instance
31  
-     *
32 29
      * @throws \InvalidArgumentException When provided tag is not defined in this extension
33 30
      */
34  
-    function load($tag, array $config, ContainerBuilder $configuration);
  31
+    function load(array $config, ContainerBuilder $configuration);
35 32
 
36 33
     /**
37 34
      * Returns the namespace to be used for this extension (XML namespace).
2  src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
@@ -377,7 +377,7 @@ protected function loadFromExtensions(SimpleXMLElement $xml)
377 377
                 $values = array();
378 378
             }
379 379
 
380  
-            $this->container->loadFromExtension($node->namespaceURI, $node->localName, $values);
  380
+            $this->container->loadFromExtension($node->namespaceURI, $values);
381 381
         }
382 382
     }
383 383
 
24  src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
@@ -225,22 +225,14 @@ protected function validate($content, $file)
225 225
             throw new \InvalidArgumentException(sprintf('The service file "%s" is not valid.', $file));
226 226
         }
227 227
 
228  
-        foreach (array_keys($content) as $key) {
229  
-            if (in_array($key, array('imports', 'parameters', 'services', 'interfaces'))) {
  228
+        foreach (array_keys($content) as $namespace) {
  229
+            if (in_array($namespace, array('imports', 'parameters', 'services', 'interfaces'))) {
230 230
                 continue;
231 231
             }
232 232
 
233  
-            // can it be handled by an extension?
234  
-            if (false !== strpos($key, '.')) {
235  
-                list($namespace, $tag) = explode('.', $key);
236  
-                if (!$this->container->hasExtension($namespace)) {
237  
-                    throw new \InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s).', $key, $file));
238  
-                }
239  
-
240  
-                continue;
  233
+            if (!$this->container->hasExtension($namespace)) {
  234
+                throw new \InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s).', $key, $file));
241 235
             }
242  
-
243  
-            throw new \InvalidArgumentException(sprintf('The "%s" tag is not valid (in %s).', $key, $file));
244 236
         }
245 237
 
246 238
         return $content;
@@ -274,18 +266,16 @@ protected function resolveServices($value)
274 266
 
275 267
     protected function loadFromExtensions($content)
276 268
     {
277  
-        foreach ($content as $key => $values) {
278  
-            if (in_array($key, array('imports', 'parameters', 'services', 'interfaces'))) {
  269
+        foreach ($content as $namespace => $values) {
  270
+            if (in_array($namespace, array('imports', 'parameters', 'services', 'interfaces'))) {
279 271
                 continue;
280 272
             }
281 273
 
282  
-            list($namespace, $tag) = explode('.', $key);
283  
-
284 274
             if (!is_array($values)) {
285 275
                 $values = array();
286 276
             }
287 277
 
288  
-            $this->container->loadFromExtension($namespace, $tag, $values);
  278
+            $this->container->loadFromExtension($namespace, $values);
289 279
         }
290 280
     }
291 281
 }
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.