From 4b957e8d5d37382dfbf38f7f055e50b758195709 Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Sun, 31 May 2015 15:06:45 +0200 Subject: [PATCH] Daemon application using DIC. --- console | 4 +--- daemonise | 6 ++---- services.yml | 7 +++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/console b/console index dc3b3a41..31103d33 100755 --- a/console +++ b/console @@ -12,9 +12,7 @@ define('PHPCI_IS_CONSOLE', true); require('bootstrap.php'); -use Symfony\Component\Console\Application; - -/** @var Application */ +/** @var \Symfony\Component\Console\Application */ $application = $container->get('console.application'); $application->run(); diff --git a/daemonise b/daemonise index c6238568..fbe21ceb 100755 --- a/daemonise +++ b/daemonise @@ -12,9 +12,7 @@ define('PHPCI_IS_CONSOLE', true); require('bootstrap.php'); -use PHPCI\Command\DaemoniseCommand; -use Symfony\Component\Console\Application; +/** @var \Symfony\Component\Console\Application */ +$application = $container->get('daemon.application'); -$application = new Application(); -$application->add(new DaemoniseCommand($loggerConfig->getFor('DaemoniseCommand'))); $application->run(); diff --git a/services.yml b/services.yml index 44072633..f955034a 100644 --- a/services.yml +++ b/services.yml @@ -145,6 +145,13 @@ services: - [add, ['@console.command.poll']] - [add, ['@console.command.create_admin']] - [add, ['@console.command.create_build']] + daemon.application: + class: Symfony\Component\Console\Application + arguments: + - %application.name% + - %application.version% + calls: + - [add, ['@console.command.daemon']] console.logger: class: Monolog\Logger arguments: