8000 Iterating through all the tags on the service · symfony/symfony@91812e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 91812e2

Browse files
committed
Iterating through all the tags on the service
1 parent e579aac commit 91812e2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ public function process(ContainerBuilder $container)
3838
$container->getDefinition('serializer')->replaceArgument(1, $encoders);
3939
}
4040

41-
private function findAndSortTaggedServices($tag, $container)
41+
private function findAndSortTaggedServices($tag_name, $container)
4242
{
4343
// Find tagged services
4444
$servs = array();
45-
foreach ($container->findTaggedServiceIds($tag) as $serviceId => $value) {
46-
$priority = isset($value[0]['priority']) ? $value[0]['priority'] : 0;
47-
$servs[$priority][] = new Reference($serviceId);
45+
foreach ($container->findTaggedServiceIds($tag_name) as $serviceId => $tags) {
46+
foreach($tags as $tag) {
47+
$priority = isset($tag['priority']) ? $tag['priority'] : 0;
48+
$servs[$priority][] = new Reference($serviceId);
49+
}
4850
}
4951

5052
// Sort them
@@ -53,7 +55,7 @@ private function findAndSortTaggedServices($tag, $container)
5355
// Flatten the array
5456
$services = array();
5557
array_walk_recursive($servs, function($a) use (&$services) { $services[] = $a; });
56-
58+
5759
return $services;
5860
}
5961
}

0 commit comments

Comments
 (0)
0