Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FrameworkBundle] do not re-register commands each time a Console\Application is run #8242

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Symfony/Bundle/FrameworkBundle/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
class Application extends BaseApplication
{
private $kernel;
private $commandsRegistered = false;

/**
* Constructor.
Expand Down Expand Up @@ -65,7 +66,9 @@ public function getKernel()
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->registerCommands();
if (!$this->commandsRegistered) {
$this->registerCommands();
}

$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the dispatcher may not need to be set each time as well?


Expand All @@ -89,5 +92,7 @@ protected function registerCommands()
$bundle->registerCommands($this);
}
}

$this->commandsRegistered = true;
}
}