From 2e3d803e7ae703a3aedd52d4f19904d1fabc36f5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 30 Nov 2016 16:03:48 +0100 Subject: [PATCH 1/4] Use the new configurator YAML syntax --- service_container/configurators.rst | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/service_container/configurators.rst b/service_container/configurators.rst index 1cb5f32bd59..ebf40a5fe94 100644 --- a/service_container/configurators.rst +++ b/service_container/configurators.rst @@ -127,12 +127,12 @@ You can configure the service configurator using the ``configurator`` option: app.newsletter_manager: class: AppBundle\Mail\NewsletterManager arguments: ['@mailer'] - configurator: ['@app.email_configurator', configure] + configurator: 'app.email_configurator:configure' app.greeting_card_manager: class: AppBundle\Mail\GreetingCardManager arguments: ['@mailer'] - configurator: ['@app.email_configurator', configure] + configurator: 'app.email_configurator:configure' .. code-block:: xml @@ -186,6 +186,20 @@ You can configure the service configurator using the ``configurator`` option: ->setConfigurator(array(new Reference('app.email_configurator'), 'configure')) ; +.. note:: + + The ``service_id:method_name`` syntax for the YAML configuration format was + introduced in Symfony 3.2. In previous versions, you must use the extended + configurator syntax: + + .. code-block:: yaml + + app.newsletter_manager: + # new syntax + configurator: 'app.email_configurator:configure' + # old syntax + configurator: ['@app.email_configurator', configure] + That's it! When requesting the ``app.newsletter_manager`` or ``app.greeting_card_manager`` service, the created instance will first be passed to the ``EmailConfigurator::configure()`` method. From 3a11c5a8c6e7b29b61a0a7764a8bc5469f286e62 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 1 Dec 2016 12:46:30 +0100 Subject: [PATCH 2/4] Added a versionadded directive --- service_container/configurators.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/service_container/configurators.rst b/service_container/configurators.rst index ebf40a5fe94..c588e137084 100644 --- a/service_container/configurators.rst +++ b/service_container/configurators.rst @@ -188,9 +188,8 @@ You can configure the service configurator using the ``configurator`` option: .. note:: - The ``service_id:method_name`` syntax for the YAML configuration format was - introduced in Symfony 3.2. In previous versions, you must use the extended - configurator syntax: + The traditional configurators syntax in YAML files used an array to define + the service id and the method name: .. code-block:: yaml @@ -200,6 +199,10 @@ You can configure the service configurator using the ``configurator`` option: # old syntax configurator: ['@app.email_configurator', configure] + .. versionadded:: 3.2 + The ``service_id:method_name`` syntax for the YAML configuration format + was introduced in Symfony 3.2. + That's it! When requesting the ``app.newsletter_manager`` or ``app.greeting_card_manager`` service, the created instance will first be passed to the ``EmailConfigurator::configure()`` method. From bfc1cee691692f4c270f41d4398e1b9c54d7d07a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 1 Dec 2016 12:54:47 +0100 Subject: [PATCH 3/4] Minor fix --- service_container/configurators.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_container/configurators.rst b/service_container/configurators.rst index c588e137084..eafb9cf7b48 100644 --- a/service_container/configurators.rst +++ b/service_container/configurators.rst @@ -188,7 +188,7 @@ You can configure the service configurator using the ``configurator`` option: .. note:: - The traditional configurators syntax in YAML files used an array to define + The traditional configurator syntax in YAML files used an array to define the service id and the method name: .. code-block:: yaml From dc483f5873ec7f6b91a914b7a850ef0dddb75306 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 15 Apr 2017 16:43:44 +0200 Subject: [PATCH 4/4] Moved the versionadded directive --- service_container/configurators.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service_container/configurators.rst b/service_container/configurators.rst index eafb9cf7b48..5c716b6b730 100644 --- a/service_container/configurators.rst +++ b/service_container/configurators.rst @@ -199,9 +199,9 @@ You can configure the service configurator using the ``configurator`` option: # old syntax configurator: ['@app.email_configurator', configure] - .. versionadded:: 3.2 - The ``service_id:method_name`` syntax for the YAML configuration format - was introduced in Symfony 3.2. +.. versionadded:: 3.2 + The ``service_id:method_name`` syntax for the YAML configuration format + was introduced in Symfony 3.2. That's it! When requesting the ``app.newsletter_manager`` or ``app.greeting_card_manager`` service, the created instance will first be