Skip to content

Commit c3afa28

Browse files
authored
Update configurators.rst
The first example at https://symfony.com/doc/current/service_container/configurators.html#using-the-configurator will never work because ConfiguratorTrait::configurator(string|array|ReferenceConfigurator $configurator) expect only one parameter. Configurator will try to call special __invoke() (which is probably undefined at this point) method while the user expects to call configure() method. We must provide an array in this case.
1 parent fa0f561 commit c3afa28

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

service_container/configurators.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ all the classes are already loaded as services. All you need to do is specify th
181181
// override the services to set the configurator
182182
// In versions earlier to Symfony 5.1 the service() function was called ref()
183183
$services->set(NewsletterManager::class)
184-
->configurator(service(EmailConfigurator::class), 'configure');
184+
->configurator([service(EmailConfigurator::class), 'configure']);
185185
186186
$services->set(GreetingCardManager::class)
187-
->configurator(service(EmailConfigurator::class), 'configure');
187+
->configurator([service(EmailConfigurator::class), 'configure']);
188188
};
189189
190190
.. _configurators-invokable:

0 commit comments

Comments
 (0)