Skip to content

Commit a5ea7b1

Browse files
javiereguiluzxabbuh
authored andcommitted
Added a tip about the expanded YAML syntax
1 parent 9576bc1 commit a5ea7b1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

service_container.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,29 @@ Injecting the dependency by the setter method just needs a change of syntax:
456456
and "setter injection". The Symfony service container also supports
457457
"property injection".
458458

459+
.. tip::
460+
461+
The YAML configuration files support an expanded syntax which may be useful
462+
when the YAML contents are long and complex:
463+
464+
.. code-block:: yaml
465+
466+
# app/config/services.yml
467+
services:
468+
# traditional syntax
469+
app.newsletter_manager:
470+
class: AppBundle\Newsletter\NewsletterManager
471+
calls:
472+
- [setMailer, ['@app.mailer']]
473+
474+
# expanded syntax
475+
app.newsletter_manager:
476+
class: AppBundle\Newsletter\NewsletterManager
477+
calls:
478+
- method: setMailer
479+
arguments:
480+
- '@app.mailer'
481+
459482
Learn more
460483
----------
461484

0 commit comments

Comments
 (0)