From eef32d4372ee3bb46a02c71d4c04a5e14f5fb191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20H=C3=B6rnicke?= Date: Tue, 24 Jun 2014 11:02:24 +0200 Subject: [PATCH] added method to be able to reuse the console application --- .../ORM/Tools/Console/ConsoleRunner.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php b/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php index 7e88615aa..c69e2342b 100644 --- a/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php +++ b/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php @@ -55,13 +55,29 @@ class ConsoleRunner * @return void */ static public function run(HelperSet $helperSet, $commands = array()) + { + $cli = self::createApplication($helperSet, $commands); + $cli->run(); + } + + /** + * Creates a console application with the given helperset and + * optional commands. + * + * @param \Symfony\Component\Console\Helper\HelperSet $helperSet + * @param array $commands + * + * @return \Symfony\Component\Console\Application + */ + static public function createApplication(HelperSet $helperSet, $commands = array()) { $cli = new Application('Doctrine Command Line Interface', Version::VERSION); $cli->setCatchExceptions(true); $cli->setHelperSet($helperSet); self::addCommands($cli); $cli->addCommands($commands); - $cli->run(); + + return $cli; } /**