From e06588cb1105efc2aa0e6761ad6636da1bf14475 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 16 Jan 2017 16:35:48 +0100 Subject: [PATCH 1/2] Added a tip about the expanded YAML syntax --- service_container.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/service_container.rst b/service_container.rst index 632da917743..cb37e530505 100644 --- a/service_container.rst +++ b/service_container.rst @@ -456,6 +456,28 @@ Injecting the dependency by the setter method just needs a change of syntax: and "setter injection". The Symfony service container also supports "property injection". +.. tip:: + + The YAML configuration files support an expanded syntax which may be useful + when the YAML contents are long and complex: + + .. code-block:: yaml + + services: + # traditional syntax + app.newsletter_manager: + class: AppBundle\Newsletter\NewsletterManager + calls: + - [setMailer, ['@app.mailer']] + + # expanded syntax + app.newsletter_manager: + class: AppBundle\Newsletter\NewsletterManager + calls: + - method: setMailer + arguments: + - '@app.mailer' + Learn more ---------- From a14c77c8200eced17be642994687c97d25dd2932 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 16 Jan 2017 22:53:49 +0100 Subject: [PATCH 2/2] Added the missing file path --- service_container.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/service_container.rst b/service_container.rst index cb37e530505..b61c37063e7 100644 --- a/service_container.rst +++ b/service_container.rst @@ -463,6 +463,7 @@ Injecting the dependency by the setter method just needs a change of syntax: .. code-block:: yaml + # app/config/services.yml services: # traditional syntax app.newsletter_manager: