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

Appearance settings

Commit 9e78259

Browse filesBrowse 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
Copy full SHA for 9e78259

File tree

1 file changed

+23
-0
lines changed
Filter options

1 file changed

+23
-0
lines changed

‎service_container.rst

Copy file name to clipboardExpand all lines: service_container.rst
+23Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.