@@ -19,8 +19,7 @@ to be used for a specific purpose. Take the following example:
19
19
app.twig_extension :
20
20
class : AppBundle\Twig\AppExtension
21
21
public : false
22
- tags :
23
- - { name: twig.extension }
22
+ tags : [twig.extension]
24
23
25
24
.. code-block :: xml
26
25
@@ -148,13 +147,11 @@ For example, you may add the following transports as services:
148
147
app.smtp_transport :
149
148
class : \Swift_SmtpTransport
150
149
arguments : ['%mailer_host%']
151
- tags :
152
- - { name: app.mail_transport }
150
+ tags : [app.mail_transport]
153
151
154
152
app.sendmail_transport :
155
153
class : \Swift_SendmailTransport
156
- tags :
157
- - { name: app.mail_transport }
154
+ tags : [app.mail_transport]
158
155
159
156
.. code-block :: xml
160
157
@@ -341,6 +338,26 @@ To answer this, change the service declaration:
341
338
$definitionSendmail->addTag('app.mail_transport', array('alias' => 'bar'));
342
339
$container->setDefinition('app.sendmail_transport', $definitionSendmail);
343
340
341
+ .. tip ::
342
+
343
+ In YAML format, you may provide the tag as a simple string as long as you don't need to specify additional
344
+ attributes. The following definitions are equivalent.
345
+
346
+ .. code-block :: yaml
347
+
348
+ services :
349
+
350
+ # Compact syntax
351
+ app.sendmail_transport :
352
+ class : \Swift_SendmailTransport
353
+ tags : [app.mail_transport]
354
+
355
+ # Verbose syntax
356
+ app.sendmail_transport :
357
+ class : \Swift_SendmailTransport
358
+ tags :
359
+ - { name: app.mail_transport }
360
+
344
361
Notice that you've added a generic ``alias `` key to the tag. To actually
345
362
use this, update the compiler::
346
363
0 commit comments