From b95ab440280ca5e5e94fe1f96f4f947734e37da3 Mon Sep 17 00:00:00 2001 From: Carlo Date: Sat, 12 Jul 2014 17:19:43 +0200 Subject: [PATCH] [ticket/12685] Add console collection and fixing CLI Added a commands service collection and removed CLI container PHPBB3-12685 --- phpBB/config/console.yml | 6 ++++++ phpBB/phpbb/console/application.php | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index 00b8f9cec0..f4beb1c089 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -1,4 +1,10 @@ services: + console.command_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: console.command } console.command.cache.purge: class: phpbb\console\command\cache\purge arguments: diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index b1f0635913..72fcee5cfa 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -17,7 +17,7 @@ use Symfony\Component\Console\Shell; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\DependencyInjection\TaggedContainerInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; class application extends \Symfony\Component\Console\Application { @@ -73,14 +73,13 @@ class application extends \Symfony\Component\Console\Application /** * Register a set of commands from the container * - * @param TaggedContainerInterface $container The container - * @param string $tag The tag used to register the commands + * @param ContainerInterface $container The container */ - public function register_container_commands(TaggedContainerInterface $container, $tag = 'console.command') + public function register_container_commands(ContainerInterface $container) { - foreach($container->findTaggedServiceIds($tag) as $id => $void) + foreach($container->get('console.command_collection') as $service_command) { - $this->add($container->get($id)); + $this->add($service_command); } }