merged branch lsmith77/bundle_inheritance_in_config_dump_reference (PR #5126)
Commits
-------
cdfbe72
handle inheritance in config:dump-reference when a bundle name is passed to the command
Discussion
----------
handle inheritance in config:dump-reference
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: ?
Fixes the following tickets: -
License of the code: MIT
Currently when passing in a bundle name that identifies a bundle that is a parent to another bundle, it will not return the reference for the requested bundle, but for the inheriting (even if that bundle has no configuration class).
F.e.
app/console config:dump-reference SymfonyCmfBlockBundle
will fail if there is a Bundle SandboxBlockBundle that has SymfonyCmfBlockBundle set as the parent.
This commit is contained in:
commit
842b599c50
@ -62,7 +62,7 @@ EOF
|
|||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$this->output = $output;
|
$this->output = $output;
|
||||||
$kernel = $this->getContainer()->get('kernel');
|
$bundles = $this->getContainer()->get('kernel')->getBundles();
|
||||||
$containerBuilder = $this->getContainerBuilder();
|
$containerBuilder = $this->getContainerBuilder();
|
||||||
|
|
||||||
$name = $input->getArgument('name');
|
$name = $input->getArgument('name');
|
||||||
@ -71,7 +71,10 @@ EOF
|
|||||||
|
|
||||||
if (preg_match('/Bundle$/', $name)) {
|
if (preg_match('/Bundle$/', $name)) {
|
||||||
// input is bundle name
|
// input is bundle name
|
||||||
$extension = $kernel->getBundle($name)->getContainerExtension();
|
|
||||||
|
if (isset($bundles[$name])) {
|
||||||
|
$extension = $bundles[$name]->getContainerExtension();
|
||||||
|
}
|
||||||
|
|
||||||
if (!$extension) {
|
if (!$extension) {
|
||||||
throw new \LogicException('No extensions with configuration available for "'.$name.'"');
|
throw new \LogicException('No extensions with configuration available for "'.$name.'"');
|
||||||
@ -79,7 +82,7 @@ EOF
|
|||||||
|
|
||||||
$message = 'Default configuration for "'.$name.'"';
|
$message = 'Default configuration for "'.$name.'"';
|
||||||
} else {
|
} else {
|
||||||
foreach ($kernel->getBundles() as $bundle) {
|
foreach ($bundles as $bundle) {
|
||||||
$extension = $bundle->getContainerExtension();
|
$extension = $bundle->getContainerExtension();
|
||||||
|
|
||||||
if ($extension && $extension->getAlias() === $name) {
|
if ($extension && $extension->getAlias() === $name) {
|
||||||
|
Reference in New Issue
Block a user