Skip to content

Commit 9e78259

Browse files
committed
minor #7376 Added a tip about the expanded YAML syntax (javiereguiluz)
This PR was squashed before being merged into the 2.7 branch (closes #7376). Discussion ---------- Added a tip about the expanded YAML syntax This fixes #5107. Commits ------- a5ea7b1 Added a tip about the expanded YAML syntax
2 parents c764769 + a5ea7b1 commit 9e78259

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

service_container.rst

+23
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)