Просмотр исходного кода

changed all extensions to use the default Extension::getAlias() impl

Fabien Potencier 14 лет назад
Родитель
Сommit
23e9386a0e

+ 1 - 6
src/Symfony/Bundle/AsseticBundle/DependencyInjection/AsseticExtension.php

@@ -11,7 +11,7 @@
 
 namespace Symfony\Bundle\AsseticBundle\DependencyInjection;
 
-use Symfony\Component\DependencyInjection\Extension\Extension;
+use Symfony\Component\HttpKernel\DependencyInjection\Extension;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
 use Symfony\Component\Config\FileLocator;
@@ -110,9 +110,4 @@ class AsseticExtension extends Extension
     {
         return 'http://www.symfony-project.org/schema/dic/assetic';
     }
-
-    public function getAlias()
-    {
-        return 'assetic';
-    }
 }

+ 0 - 12
src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php

@@ -576,16 +576,4 @@ class DoctrineExtension extends AbstractDoctrineExtension
     {
         return 'http://www.symfony-project.org/schema/dic/doctrine';
     }
-
-    /**
-     * Returns the recommended alias to use in XML.
-     *
-     * This alias is also the mandatory prefix to use when using YAML.
-     *
-     * @return string The alias
-     */
-    public function getAlias()
-    {
-        return 'doctrine';
-    }
 }

+ 0 - 12
src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php

@@ -391,16 +391,4 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
     {
         return __DIR__.'/../Resources/config/schema';
     }
-
-    /**
-     * Returns the recommended alias to use in XML.
-     *
-     * This alias is also the mandatory prefix to use when using YAML.
-     *
-     * @return string The alias
-     */
-    public function getAlias()
-    {
-        return 'doctrine_mongo_db';
-    }
 }

+ 0 - 5
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

@@ -503,9 +503,4 @@ class FrameworkExtension extends Extension
     {
         return 'http://www.symfony-project.org/schema/dic/symfony';
     }
-
-    public function getAlias()
-    {
-        return 'framework';
-    }
 }

+ 16 - 20
src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

@@ -107,26 +107,6 @@ class SecurityExtension extends Extension
         ));
     }
 
-    /**
-     * Returns the base path for the XSD files.
-     *
-     * @return string The XSD base path
-     */
-    public function getXsdValidationBasePath()
-    {
-        return __DIR__.'/../Resources/config/schema';
-    }
-
-    public function getNamespace()
-    {
-        return 'http://www.symfony-project.org/schema/dic/security';
-    }
-
-    public function getAlias()
-    {
-        return 'security';
-    }
-
     protected function aclLoad($config, ContainerBuilder $container)
     {
         $loader = new XmlFileLoader($container, new FileLocator(array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config')));
@@ -591,4 +571,20 @@ class SecurityExtension extends Extension
 
         return $this->factories = $factories;
     }
+
+
+    /**
+     * Returns the base path for the XSD files.
+     *
+     * @return string The XSD base path
+     */
+    public function getXsdValidationBasePath()
+    {
+        return __DIR__.'/../Resources/config/schema';
+    }
+
+    public function getNamespace()
+    {
+        return 'http://www.symfony-project.org/schema/dic/security';
+    }
 }

+ 0 - 12
src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php

@@ -121,16 +121,4 @@ class SwiftMailerExtension extends Extension
     {
         return 'http://www.symfony-project.org/schema/dic/swiftmailer';
     }
-
-    /**
-     * Returns the recommended alias to use in XML.
-     *
-     * This alias is also the mandatory prefix to use when using YAML.
-     *
-     * @return string The alias
-     */
-    public function getAlias()
-    {
-        return 'swiftmailer';
-    }
 }

+ 0 - 5
src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

@@ -102,9 +102,4 @@ class TwigExtension extends Extension
     {
         return 'http://www.symfony-project.org/schema/dic/twig';
     }
-
-    public function getAlias()
-    {
-        return 'twig';
-    }
 }

+ 0 - 5
src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php

@@ -82,9 +82,4 @@ class WebProfilerExtension extends Extension
     {
         return 'http://www.symfony-project.org/schema/dic/webprofiler';
     }
-
-    public function getAlias()
-    {
-        return 'web_profiler';
-    }
 }

+ 0 - 5
src/Symfony/Bundle/ZendBundle/DependencyInjection/ZendExtension.php

@@ -101,9 +101,4 @@ class ZendExtension extends Extension
     {
         return 'http://www.symfony-project.org/schema/dic/zend';
     }
-
-    public function getAlias()
-    {
-        return 'zend';
-    }
 }

+ 15 - 3
src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php

@@ -75,19 +75,31 @@ abstract class Extension extends BaseExtension
         return false;
     }
 
+    /**
+     * Returns the namespace to be used for this extension (XML namespace).
+     *
+     * @return string The XML namespace
+     */
     public function getNamespace()
     {
         return false;
     }
-    
+
+    /**
+     * Returns the recommended alias to use in XML.
+     *
+     * This alias is also the mandatory prefix to use when using YAML.
+     *
+     * @return string The alias
+     */
     public function getAlias()
     {
         $className = get_class($this);
         if (substr($className, -9) != 'Extension') {
-            throw new \BadMethodCallException('This extension does not follow the normal naming, so you must overwrite the getAlias method');
+            throw new \BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.');
         }
         $classBaseName = substr(strrchr($className, '\\'), 1, -9);
-        
+
         return Container::underscore($classBaseName);
     }
 }