Prechádzať zdrojové kódy

[HttpKernel] allowed bundle names to have 'bundle' in their base name

Fabien Potencier 14 rokov pred
rodič
commit
77f9daf374

+ 4 - 2
src/Symfony/Component/HttpKernel/Bundle/Bundle.php

@@ -65,12 +65,14 @@ abstract class Bundle extends ContainerAware implements BundleInterface
     public function getContainerExtension()
     {
         if (null === $this->extension) {
-            $class = $this->getNamespace().'\\DependencyInjection\\'.str_replace('Bundle', 'Extension', $this->getName());
+            $basename = preg_replace('/Bundle$/', '', $this->getName());
+
+            $class = $this->getNamespace().'\\DependencyInjection\\'.$basename.'Extension';
             if (class_exists($class)) {
                 $extension = new $class();
 
                 // check naming convention
-                $expectedAlias = Container::underscore(str_replace('Bundle', '', $this->getName()));
+                $expectedAlias = Container::underscore($basename);
                 if ($expectedAlias != $extension->getAlias()) {
                     throw new \LogicException(sprintf(
                         'The extension alias for the default extension of a '.