diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index a43e08c7fe..0bff46a2d7 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -848,9 +848,20 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Returns service ids for a given tag. * + * Example: + * + * $container->register('foo')->addTag('my.tag', array('hello' => 'world')); + * + * $serviceIds = $container->findTaggedServiceIds('my.tag'); + * foreach ($serviceIds as $serviceId => $tags) { + * foreach ($tags as $tag) { + * echo $tag['hello']; + * } + * } + * * @param string $name The tag name * - * @return array An array of tags + * @return array An array of tags with the tagged service as key, holding a list of attribute arrays. * * @api */ @@ -858,7 +869,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface { $tags = array(); foreach ($this->getDefinitions() as $id => $definition) { - if ($definition->getTag($name)) { + if ($definition->hasTag($name)) { $tags[$id] = $definition->getTag($name); } }