8000 feature #7203 Use the new configurator YAML syntax (javiereguiluz) · symfony/symfony-docs@e16a95d · GitHub
[go: up one dir, main page]

Skip to content

Commit e16a95d

Browse files
committed
feature #7203 Use the new configurator YAML syntax (javiereguiluz)
This PR was squashed before being merged into the 3.2 branch (closes #7203). Discussion ---------- Use the new configurator YAML syntax This fixes #7176. Commits ------- 88e30b0 Use the new configurator YAML syntax
2 parents 1c643c4 + 88e30b0 commit e16a95d

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
@@ -190,6 +190,23 @@ You can configure the service configurator using the ``configurator`` option:
190190
->setConfigurator(array(new Reference('app.email_configurator'), 'configure'))
191191
;
192192
193+
.. note::
194+
195+
The traditional configurator syntax in YAML files used an array to define
196+
the service id and the method name:
197+
198+
.. code-block:: yaml
199+
200+
app.newsletter_manager:
201+
# new syntax
202+
configurator: 'app.email_configurator:configure'
203+
# old syntax
204+
configurator: ['@app.email_configurator', configure]
205+
206+
.. versionadded:: 3.2
207+
The ``service_id:method_name`` syntax for the YAML configuration format
208+
was introduced in Symfony 3.2.
209+
193210
That's it! When requesting the ``app.newsletter_manager`` or
194211
``app.greeting_card_manager`` service, the created instance will first be
195212
passed to the ``EmailConfigurator::configure()`` method.

0 commit comments

Comments
 (0)
0