From c3afa28bb106f6347919ecb73578cad6344af869 Mon Sep 17 00:00:00 2001 From: Pierre Joube Date: Thu, 10 Mar 2022 16:52:12 +0100 Subject: [PATCH] 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. --- service_container/configurators.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service_container/configurators.rst b/service_container/configurators.rst index 1ade37244c3..7cf3f4e09c5 100644 --- a/service_container/configurators.rst +++ b/service_container/configurators.rst @@ -181,10 +181,10 @@ all the classes are already loaded as services. All you need to do is specify th // override the services to set the configurator // In versions earlier to Symfony 5.1 the service() function was called ref() $services->set(NewsletterManager::class) - ->configurator(service(EmailConfigurator::class), 'configure'); + ->configurator([service(EmailConfigurator::class), 'configure']); $services->set(GreetingCardManager::class) - ->configurator(service(EmailConfigurator::class), 'configure'); + ->configurator([service(EmailConfigurator::class), 'configure']); }; .. _configurators-invokable: