@@ -517,8 +517,9 @@ To answer this, change the service declaration:
517
517
518
518
.. tip ::
519
519
520
- In XML and YAML format, you may provide the tag an attribute called ``name ``.
521
- When doing so, this is the syntax you should follow:
520
+ The ``name `` attribute is used by default to define the name of the tag.
521
+ If you want to add a ``name `` attribute to some tag in XML or YAML formats,
522
+ you need to use this special syntax:
522
523
523
524
.. configuration-block ::
524
525
@@ -529,6 +530,9 @@ To answer this, change the service declaration:
529
530
MailerSmtpTransport :
530
531
arguments : ['%mailer_host%']
531
532
tags :
533
+ # this is a tag called 'app.mail_transport'
534
+ - { name: 'app.mail_transport', alias: 'smtp' }
535
+ # this is a tag called 'app.mail_transport' with two attributes ('name' and 'alias')
532
536
- app.mail_transport : { name: 'arbitrary-value', alias: 'smtp' }
533
537
534
538
.. code-block :: xml
@@ -543,7 +547,9 @@ To answer this, change the service declaration:
543
547
<services >
544
548
<service id =" MailerSmtpTransport" >
545
549
<argument >%mailer_host%</argument >
546
-
550
+ <!-- this is a tag called 'app.mail_transport' -->
551
+ <tag name =" app.mail_transport" alias =" sendmail" />
552
+ <!-- this is a tag called 'app.mail_transport' with two attributes ('name' and 'alias') -->
547
553
<tag name =" arbitrary-value" alias =" smtp" >app.mail_transport</tag >
548
554
</service >
549
555
</services >
0 commit comments