diff --git a/service_container.rst b/service_container.rst index 632da917743..b61c37063e7 100644 --- a/service_container.rst +++ b/service_container.rst @@ -456,6 +456,29 @@ 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 + + # app/config/services.yml + 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 ----------