Skip to content

Commit

Permalink
[FrameworkBundle][Console] Load command from DIC after command from b…
Browse files Browse the repository at this point in the history
…undles.

It's better to load a command from DIC after other one. Because it
allow easy override of default (symfony/assetic/doctrine) command.
The end user could do:

    # config.yml
    services:
        assetic.command.dump:
            class: SensioLabs\Shim\Assetic\DumpCommand
            tags:
                - { name: console.command }
  • Loading branch information
lyrixx committed Feb 13, 2014
1 parent f828aee commit 34f4ef5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Symfony/Bundle/FrameworkBundle/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ protected function registerCommands()
{
$container = $this->kernel->getContainer();

if ($container->hasParameter('console.command.ids')) {
foreach ($container->getParameter('console.command.ids') as $id) {
$this->add($container->get($id));
}
}

foreach ($this->kernel->getBundles() as $bundle) {
if ($bundle instanceof Bundle) {
$bundle->registerCommands($this);
}
}

if ($container->hasParameter('console.command.ids')) {
foreach ($container->getParameter('console.command.ids') as $id) {
$this->add($container->get($id));
}
}
}
}

0 comments on commit 34f4ef5

Please sign in to comment.