File tree Expand file tree Collapse file tree 3 files changed +5
-30
lines changed Expand file tree Collapse file tree 3 files changed +5
-30
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ To use it, first register a new handler service:
2828
2929 # If you're using Doctrine & want to re-use that connection, then:
3030 # comment-out the above 2 lines and uncomment the line below
31- # - !service { class: PDO, factory: ' database_connection:getWrappedConnection' }
31+ # - !service { class: PDO, factory: ['@ database_connection', getWrappedConnection] }
3232 # If you get transaction issues (e.g. after login) uncomment the line below
3333 # - { lock_mode: 1 }
3434
Original file line number Diff line number Diff 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 App\Mail\NewsletterManager :
139- configurator : ' App\Mail\EmailConfigurator:configure '
139+ configurator : ['@ App\Mail\EmailConfigurator', configure]
140140
141141 App\Mail\GreetingCardManager :
142- configurator : ' App\Mail\EmailConfigurator:configure '
142+ configurator : ['@ App\Mail\EmailConfigurator', configure]
143143
144144 .. code-block :: xml
145145
@@ -184,17 +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- The traditional configurator syntax in YAML files used an array to define
188- the service id and the method name:
189-
190- .. code-block :: yaml
191-
192- app.newsletter_manager :
193- # new syntax
194- configurator : ' App\Mail\EmailConfigurator:configure'
195- # old syntax
196- configurator : ['@App\Mail\EmailConfigurator', configure]
197-
198187 That's it! When requesting the ``App\Mail\NewsletterManager `` or
199188``App\Mail\GreetingCardManager `` service, the created instance will first be
200189passed to the ``EmailConfigurator::configure() `` method.
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ Configuration of the service container then looks like this:
104104
105105 App\Email\NewsletterManager :
106106 # call a method on the specified factory service
107- factory : ' App\Email\NewsletterManagerFactory:createNewsletterManager '
107+ factory : ['@ App\Email\NewsletterManagerFactory', createNewsletterManager]
108108
109109 .. code-block :: xml
110110
@@ -144,20 +144,6 @@ Configuration of the service container then looks like this:
144144 'createNewsletterManager',
145145 ]);
146146
147- .. note ::
148-
149- The traditional configuration syntax in YAML files used an array to define
150- the factory service and the method name:
151-
152- .. code-block :: yaml
153-
154- # config/services.yaml
155- App\Email\NewsletterManager :
156- # new syntax
157- factory : ' App\Email\NewsletterManagerFactory:createNewsletterManager'
158- # old syntax
159- factory : ['@App\Email\NewsletterManagerFactory', createNewsletterManager]
160-
161147 .. _factories-passing-arguments-factory-method :
162148
163149Passing Arguments to the Factory Method
@@ -181,7 +167,7 @@ example takes the ``templating`` service as an argument:
181167 # ...
182168
183169 App\Email\NewsletterManager :
184- factory : ' App\Email\NewsletterManagerFactory:createNewsletterManager '
170+ factory : ['@ App\Email\NewsletterManagerFactory', createNewsletterManager]
185171 arguments : ['@templating']
186172
187173 .. code-block :: xml
You can’t perform that action at this time.
0 commit comments