1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-22 19:07:27 +01:00

[ticket/12685] Add console collection and fixing CLI

Added a commands service collection and removed CLI container

PHPBB3-12685
This commit is contained in:
Carlo 2014-07-12 17:19:43 +02:00
parent 0d6fe20372
commit b95ab44028
2 changed files with 11 additions and 6 deletions

View File

@ -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:

View File

@ -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);
}
}