bug #17486 [FrameworkBundle] Throw for missing container extensions (kix)

This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #17486).

Discussion
----------

[FrameworkBundle] Throw for missing container extensions

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

This covers the case when an existing bundle does not have an extension, and its config is dumped. Before, calling `app/console config:dump` on such bundle lead to FatalErrorException with ```Call to a member function getAlias() on null```, now we process such cases and throw an exception with some explanatory text.

Commits
-------

884368e Throw for missing container extensions
This commit is contained in:
Fabien Potencier 2016-01-25 10:38:11 +01:00
commit 2ab5edbf48
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();
}