Skip to content

Commit 5915128

Browse files
tomdmaguirefabpot
authored andcommitted
do not re-register commands each time a Console\Application is run
1 parent 955d506 commit 5915128

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Console/Application.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
class Application extends BaseApplication
2828
{
2929
private $kernel;
30+
private $commandsRegistered = false;
3031

3132
/**
3233
* Constructor.
@@ -65,7 +66,9 @@ public function getKernel()
6566
*/
6667
public function doRun(InputInterface $input, OutputInterface $output)
6768
{
68-
$this->registerCommands();
69+
if (!$this->commandsRegistered) {
70+
$this->registerCommands();
71+
}
6972

7073
if (true === $input->hasParameterOption(array('--shell', '-s'))) {
7174
$shell = new Shell($this);
@@ -87,5 +90,7 @@ protected function registerCommands()
8790
$bundle->registerCommands($this);
8891
}
8992
}
93+
94+
$this->commandsRegistered = true;
9095
}
9196
}

0 commit comments

Comments
 (0)