diff options
| author | Mate Bartus <mate.bartus@gmail.com> | 2015-07-09 19:08:28 +0200 |
|---|---|---|
| committer | Mate Bartus <mate.bartus@gmail.com> | 2015-07-09 19:08:28 +0200 |
| commit | e967f3c1a81eab0f14daf314b7fb1b2001e4d220 (patch) | |
| tree | 5cc1fb9d39392e53ce1f50a33ee33aee8115bfae /phpBB/phpbb/di/pass | |
| parent | b284e31a9e55e5fc617a229439282cc6d746432a (diff) | |
| download | forums-e967f3c1a81eab0f14daf314b7fb1b2001e4d220.tar forums-e967f3c1a81eab0f14daf314b7fb1b2001e4d220.tar.gz forums-e967f3c1a81eab0f14daf314b7fb1b2001e4d220.tar.bz2 forums-e967f3c1a81eab0f14daf314b7fb1b2001e4d220.tar.xz forums-e967f3c1a81eab0f14daf314b7fb1b2001e4d220.zip | |
[ticket/13740] Fix itteration problems, implement class name aware collections
PHPBB3-13740
Diffstat (limited to 'phpBB/phpbb/di/pass')
| -rw-r--r-- | phpBB/phpbb/di/pass/collection_pass.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/phpBB/phpbb/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php index ccc1250c20..341f88518d 100644 --- a/phpBB/phpbb/di/pass/collection_pass.php +++ b/phpBB/phpbb/di/pass/collection_pass.php @@ -34,10 +34,12 @@ class collection_pass implements CompilerPassInterface foreach ($container->findTaggedServiceIds('service_collection') as $id => $data) { $definition = $container->getDefinition($id); + $is_ordered_collection = (substr($definition->getClass(), -strlen('ordered_service_collection')) === 'ordered_service_collection'); + $is_class_name_aware = (isset($data[0]['class_name_aware']) && $data[0]['class_name_aware']); foreach ($container->findTaggedServiceIds($data[0]['tag']) as $service_id => $service_data) { - if (substr($definition->getClass(), -strlen('ordered_service_collection')) === 'ordered_service_collection') + if ($is_ordered_collection) { $arguments = array($service_id, $service_data[0]['order']); } @@ -46,6 +48,15 @@ class collection_pass implements CompilerPassInterface $arguments = array($service_id); } + if ($is_class_name_aware) + { + $service_definition = $container->getDefinition($service_id); + $definition->addMethodCall('add_service_class', array( + $service_id, + $service_definition->getClass() + )); + } + $definition->addMethodCall('add', $arguments); } } |
