Skip to content

Commit 88e30b0

Browse files
javiereguiluzxabbuh
authored andcommitted
Use the new configurator YAML syntax
1 parent 7a8e74a commit 88e30b0

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

service_container/configurators.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ You can configure the service configurator using the ``configurator`` option:
127127
app.newsletter_manager:
128128
class: AppBundle\Mail\NewsletterManager
129129
arguments: ['@mailer']
130-
configurator: ['@app.email_configurator', configure]
130+
configurator: 'app.email_configurator:configure'
131131
132132
app.greeting_card_manager:
133133
class: AppBundle\Mail\GreetingCardManager
134134
arguments: ['@mailer']
135-
configurator: ['@app.email_configurator', configure]
135+
configurator: 'app.email_configurator:configure'
136136
137137
.. code-block:: xml
138138
@@ -186,6 +186,23 @@ You can configure the service configurator using the ``configurator`` option:
186186
->setConfigurator(array(new Reference('app.email_configurator'), 'configure'))
187187
;
188188
189+
.. note::
190+
191+
The traditional configurator syntax in YAML files used an array to define
192+
the service id and the method name:
193+
194+
.. code-block:: yaml
195+
196+
app.newsletter_manager:
197+
# new syntax
198+
configurator: 'app.email_configurator:configure'
199+
# old syntax
200+
configurator: ['@app.email_configurator', configure]
201+
202+
.. versionadded:: 3.2
203+
The ``service_id:method_name`` syntax for the YAML configuration format
204+
was introduced in Symfony 3.2.
205+
189206
That's it! When requesting the ``app.newsletter_manager`` or
190207
``app.greeting_card_manager`` service, the created instance will first be
191208
passed to the ``EmailConfigurator::configure()`` method.

0 commit comments

Comments
 (0)