Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2665e1f

Browse files
committed
Improved naming
1 parenta4f7d51 commit2665e1f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎components/dependency_injection/tags.rst‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
Thetrickiest part is the ``$attributes`` variable. Because youcanuse the
306-
sametag many times on the same service (e.g. you could theoretically tag
307-
the same service 5 times withthe ``acme_mailer.transport``tag), ``$attributes``
308-
is an array ofthetag information for each tag on that service.
305+
Thedouble loop may be confusing. This is because a servicecanhave more than one
306+
tag. You tag a service twice or more with the ``acme_mailer.transport`` tag. The
307+
second foreach loop iterates overthe ``acme_mailer.transport``tags set for the
308+
current service and gives youtheattributes.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp