From 95840284867a74e70e39e02c6d316ac78b824261 Mon Sep 17 00:00:00 2001 From: Tom Maguire Date: Mon, 10 Jun 2013 14:35:49 +0100 Subject: [PATCH 1/2] do not re-register commands each time an FrameworkBundle\Console\Application is run --- src/Symfony/Bundle/FrameworkBundle/Console/Application.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 06a8698cf162f..22d1a43304d7f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -27,6 +27,7 @@ class Application extends BaseApplication { private $kernel; + private $commandsRegistered = false; /** * Constructor. @@ -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')); @@ -89,5 +92,7 @@ protected function registerCommands() $bundle->registerCommands($this); } } + + $this->commandsRegistered = true; } } From 1ea1405ba46f6d6cf1cb29ac64d696c566d4437f Mon Sep 17 00:00:00 2001 From: Tom Maguire Date: Mon, 10 Jun 2013 19:27:04 +0100 Subject: [PATCH 2/2] whitespace fix --- src/Symfony/Bundle/FrameworkBundle/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 22d1a43304d7f..97219c76283ab 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -66,7 +66,7 @@ public function getKernel() */ public function doRun(InputInterface $input, OutputInterface $output) { - if(!$this->commandsRegistered){ + if (!$this->commandsRegistered) { $this->registerCommands(); }