Skip to content

Commit b327acb

Browse files
committed
minor #11625 Removed the deprecated factory YAML config (javiereguiluz)
This PR was merged into the 3.4 branch. Discussion ---------- Removed the deprecated factory YAML config This backports #11589 to 3.4 so all versions use the same syntax. Commits ------- 519ccf3 Removed the deprecated factory YAML config
2 parents 025a735 + 519ccf3 commit b327acb

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

service_container/configurators.rst

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ all the classes are already loaded as services. All you need to do is specify th
136136
137137
# override the services to set the configurator
138138
AppBundle\Mail\NewsletterManager:
139-
configurator: 'AppBundle\Mail\EmailConfigurator:configure'
139+
configurator: ['@AppBundle\Mail\EmailConfigurator', 'configure']
140140
141141
AppBundle\Mail\GreetingCardManager:
142-
configurator: 'AppBundle\Mail\EmailConfigurator:configure'
142+
configurator: ['@AppBundle\Mail\EmailConfigurator', 'configure']
143143
144144
.. code-block:: xml
145145
@@ -184,22 +184,6 @@ all the classes are already loaded as services. All you need to do is specify th
184184
$container->getDefinition(GreetingCardManager::class)
185185
->setConfigurator([new Reference(EmailConfigurator::class), 'configure']);
186186
187-
.. versionadded:: 3.2
188-
189-
The ``service_id:method_name`` syntax for the YAML configuration format
190-
was introduced in Symfony 3.2.
191-
192-
The traditional configurator syntax in YAML files used an array to define
193-
the service id and the method name:
194-
195-
.. code-block:: yaml
196-
197-
app.newsletter_manager:
198-
# new syntax
199-
configurator: 'AppBundle\Mail\EmailConfigurator:configure'
200-
# old syntax
201-
configurator: ['@AppBundle\Mail\EmailConfigurator', configure]
202-
203187
That's it! When requesting the ``AppBundle\Mail\NewsletterManager`` or
204188
``AppBundle\Mail\GreetingCardManager`` service, the created instance will first be
205189
passed to the ``EmailConfigurator::configure()`` method.

service_container/factories.rst

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ configure the service container to use the
4141
4242
AppBundle\Email\NewsletterManager:
4343
# call the static method that creates the object
44-
factory: ['AppBundle\Email\NewsletterManagerStaticFactory', createNewsletterManager]
44+
factory: ['AppBundle\Email\NewsletterManagerStaticFactory', 'createNewsletterManager']
4545
# define the class of the created object
4646
class: AppBundle\Email\NewsletterManager
4747
@@ -107,7 +107,7 @@ Configuration of the service container then looks like this:
107107
108108
AppBundle\Email\NewsletterManager:
109109
# call a method on the specified factory service
110-
factory: 'AppBundle\Email\NewsletterManagerFactory:createNewsletterManager'
110+
factory: ['@AppBundle\Email\NewsletterManagerFactory', 'createNewsletterManager']
111111
class: AppBundle\Email\NewsletterManager
112112
113113
.. code-block:: xml
@@ -150,21 +150,6 @@ Configuration of the service container then looks like this:
150150
'createNewsletterManager',
151151
]);
152152
153-
.. note::
154-
155-
The traditional configuration syntax in YAML files used an array to define
156-
the factory service and the method name:
157-
158-
.. code-block:: yaml
159-
160-
# app/config/services.yml
161-
AppBundle\Email\NewsletterManager:
162-
class: AppBundle\Email\NewsletterManager
163-
# new syntax
164-
factory: 'AppBundle\Email\NewsletterManagerFactory:createNewsletterManager'
165-
# old syntax
166-
factory: ['@AppBundle\Email\NewsletterManagerFactory', createNewsletterManager]
167-
168153
.. _factories-passing-arguments-factory-method:
169154

170155
Passing Arguments to the Factory Method

0 commit comments

Comments
 (0)