File tree 3 files changed +5
-30
lines changed
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:
28
28
29
29
# If you're using Doctrine & want to re-use that connection, then:
30
30
# 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] }
32
32
# If you get transaction issues (e.g. after login) uncomment the line below
33
33
# - { lock_mode: 1 }
34
34
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
136
136
137
137
# override the services to set the configurator
138
138
App\Mail\NewsletterManager :
139
- configurator : ' App\Mail\EmailConfigurator:configure '
139
+ configurator : ['@ App\Mail\EmailConfigurator', configure]
140
140
141
141
App\Mail\GreetingCardManager :
142
- configurator : ' App\Mail\EmailConfigurator:configure '
142
+ configurator : ['@ App\Mail\EmailConfigurator', configure]
143
143
144
144
.. code-block :: xml
145
145
@@ -184,17 +184,6 @@ all the classes are already loaded as services. All you need to do is specify th
184
184
$container->getDefinition(GreetingCardManager::class)
185
185
->setConfigurator([new Reference(EmailConfigurator::class), 'configure']);
186
186
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
-
198
187
That's it! When requesting the ``App\Mail\NewsletterManager `` or
199
188
``App\Mail\GreetingCardManager `` service, the created instance will first be
200
189
passed 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:
104
104
105
105
App\Email\NewsletterManager :
106
106
# call a method on the specified factory service
107
- factory : ' App\Email\NewsletterManagerFactory:createNewsletterManager '
107
+ factory : ['@ App\Email\NewsletterManagerFactory', createNewsletterManager]
108
108
109
109
.. code-block :: xml
110
110
@@ -144,20 +144,6 @@ Configuration of the service container then looks like this:
144
144
'createNewsletterManager',
145
145
]);
146
146
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
-
161
147
.. _factories-passing-arguments-factory-method :
162
148
163
149
Passing Arguments to the Factory Method
@@ -181,7 +167,7 @@ example takes the ``templating`` service as an argument:
181
167
# ...
182
168
183
169
App\Email\NewsletterManager :
184
- factory : ' App\Email\NewsletterManagerFactory:createNewsletterManager '
170
+ factory : ['@ App\Email\NewsletterManagerFactory', createNewsletterManager]
185
171
arguments : ['@templating']
186
172
187
173
.. code-block :: xml
You can’t perform that action at this time.
0 commit comments