diff options
| author | Nils Adermann <naderman@naderman.de> | 2012-11-11 18:39:24 +0100 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2012-11-11 18:39:24 +0100 |
| commit | d2a051cdd4269fd5749bdd4e7619fc5176a510a8 (patch) | |
| tree | b4d9b386dbf57ba59486043f1838edd49cb2d621 /phpBB/includes | |
| parent | 69845585a2bc6720e6c512227f436782c7bf5d29 (diff) | |
| download | forums-d2a051cdd4269fd5749bdd4e7619fc5176a510a8.tar forums-d2a051cdd4269fd5749bdd4e7619fc5176a510a8.tar.gz forums-d2a051cdd4269fd5749bdd4e7619fc5176a510a8.tar.bz2 forums-d2a051cdd4269fd5749bdd4e7619fc5176a510a8.tar.xz forums-d2a051cdd4269fd5749bdd4e7619fc5176a510a8.zip | |
[ticket/11193] Instantiate a single collection_pass for all collections
PHPBB3-11193
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/di/pass/collection_pass.php | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/phpBB/includes/di/pass/collection_pass.php b/phpBB/includes/di/pass/collection_pass.php index 70a44d1d51..d5b82f61da 100644 --- a/phpBB/includes/di/pass/collection_pass.php +++ b/phpBB/includes/di/pass/collection_pass.php @@ -18,17 +18,13 @@ if (!defined('IN_PHPBB')) use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +/** +* Appends an add method call to the definition of each collection service for +* the services tagged with the appropriate name defined in the collection's +* service_collection tag. +*/ class phpbb_di_pass_collection_pass implements CompilerPassInterface { - private $collection_service; - private $service_tag; - - public function __construct($collection_service, $service_tag) - { - $this->collection_service = $collection_service; - $this->service_tag = $service_tag; - } - /** * Modify the container before it is passed to the rest of the code * @@ -37,11 +33,14 @@ class phpbb_di_pass_collection_pass implements CompilerPassInterface */ public function process(ContainerBuilder $container) { - $definition = $container->getDefinition($this->collection_service); - - foreach ($container->findTaggedServiceIds($this->service_tag) as $id => $data) + foreach ($container->findTaggedServiceIds('service_collection') as $id => $data) { - $definition->addMethodCall('add', array($id)); + $definition = $container->getDefinition($id); + + foreach ($container->findTaggedServiceIds($data['tag']) as $service_id => $service_data) + { + $definition->addMethodCall('add', array($service_id)); + } } } } |
