Skip to content

Commit e8cfa6e

Browse files
Remove short factories/configurators examples
1 parent 9d60165 commit e8cfa6e

File tree

3 files changed

+5
-30
lines changed

3 files changed

+5
-30
lines changed

doctrine/pdo_session_storage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

service_container/configurators.rst

Lines changed: 2 additions & 13 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
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
200189
passed to the ``EmailConfigurator::configure()`` method.

service_container/factories.rst

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff 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

163149
Passing 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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy