@@ -153,7 +153,7 @@ custom tag::
153153 $taggedServices = $container->findTaggedServiceIds(
154154 'acme_mailer.transport'
155155 );
156- foreach ($taggedServices as $id => $attributes ) {
156+ foreach ($taggedServices as $id => $tags ) {
157157 $definition->addMethodCall(
158158 'addTransport',
159159 array(new Reference($id))
@@ -178,7 +178,7 @@ run when the container is compiled::
178178 use Symfony\Component\DependencyInjection\ContainerBuilder;
179179
180180 $container = new ContainerBuilder();
181- $container->addCompilerPass(new TransportCompilerPass);
181+ $container->addCompilerPass(new TransportCompilerPass() );
182182
183183.. note ::
184184
@@ -291,8 +291,8 @@ use this, update the compiler::
291291 $taggedServices = $container->findTaggedServiceIds(
292292 'acme_mailer.transport'
293293 );
294- foreach ($taggedServices as $id => $tagAttributes ) {
295- foreach ($tagAttributes as $attributes) {
294+ foreach ($taggedServices as $id => $tags ) {
295+ foreach ($tags as $attributes) {
296296 $definition->addMethodCall(
297297 'addTransport',
298298 array(new Reference($id), $attributes["alias"])
@@ -302,7 +302,7 @@ use this, update the compiler::
302302 }
303303 }
304304
305- The trickiest part is the `` $attributes `` variable. Because you can use the
306- same tag many times on the same service (e.g. you could theoretically tag
307- the same service 5 times with the ``acme_mailer.transport `` tag), `` $attributes ``
308- is an array of the tag information for each tag on that service .
305+ The double loop may be confusing. This is because a service can have more than one
306+ tag. You tag a service twice or more with the `` acme_mailer.transport `` tag. The
307+ second foreach loop iterates over the ``acme_mailer.transport `` tags set for the
308+ current service and gives you the attributes .
0 commit comments