|
@@ -4,6 +4,7 @@ namespace Symfony\Component\HttpKernel\DependencyInjection;
|
|
|
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension as BaseExtension;
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
|
+use Symfony\Component\DependencyInjection\Container;
|
|
|
|
|
|
/*
|
|
|
* This file is part of the Symfony framework.
|
|
@@ -78,4 +79,15 @@ abstract class Extension extends BaseExtension
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ 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');
|
|
|
+ }
|
|
|
+ $classBaseName = substr(strrchr($className, '\\'), 1, -9);
|
|
|
+
|
|
|
+ return Container::underscore($classBaseName);
|
|
|
+ }
|
|
|
}
|