Throw for missing container extensions

This covers cases when a bundle does not have an extension, which
lead to FatalErrorException with ```Call to a member function getAlias() on null```
This commit is contained in:
Stepan Anchugov 2016-01-22 04:44:07 +05:00 committed by Fabien Potencier
parent fc56a5cefa
commit 884368e709
1 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,10 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
$bundles = $this->initializeBundles();
foreach ($bundles as $bundle) {
if ($name === $bundle->getName()) {
if (!$bundle->getContainerExtension()) {
throw new \LogicException(sprintf('Bundle "%s" does not have a container extension.', $name));
}
return $bundle->getContainerExtension();
}