From bce287e8fcd273e161c1e22733fd81a282c5243e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 10 Mar 2020 16:57:32 +0100 Subject: [PATCH] Revert "minor #35559 [FrameworkBundle] remove mention of the old Controller class (nicolas-grekas)" This reverts commit 6bb64734894fe1a37f51ef499fdac37f101352b2, reversing changes made to 4cce23d9ca20e447239a42e57137e744a78f65f9. --- .../DependencyInjection/FrameworkExtension.php | 2 ++ .../RemoveEmptyControllerArgumentLocatorsPass.php | 2 ++ .../RemoveEmptyControllerArgumentLocatorsPassTest.php | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 49a466f440d38..65915a73f12a1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -404,6 +404,8 @@ public function load(array $configs, ContainerBuilder $container) ->addTag('controller.argument_value_resolver'); $container->registerForAutoconfiguration(AbstractController::class) ->addTag('controller.service_arguments'); + $container->registerForAutoconfiguration('Symfony\Bundle\FrameworkBundle\Controller\Controller') + ->addTag('controller.service_arguments'); $container->registerForAutoconfiguration(DataCollectorInterface::class) ->addTag('data_collector'); $container->registerForAutoconfiguration(FormTypeInterface::class) diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php index 79e67374b2253..73f5ff2a74a5b 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php @@ -51,6 +51,8 @@ public function process(ContainerBuilder $container) } } if (!$reason) { + $controllers[$id.':'.$action] = $argumentRef; + if ('__invoke' === $action) { $controllers[$id] = $argumentRef; } diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php index 6c840aedca306..b5e55bdea9e97 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php @@ -49,7 +49,7 @@ public function testProcess() $controllers = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(['c1::fooAction'], array_keys($controllers)); + $this->assertSame(['c1::fooAction', 'c1:fooAction'], array_keys($controllers)); $this->assertSame(['bar'], array_keys($container->getDefinition((string) $controllers['c1::fooAction']->getValues()[0])->getArgument(0))); $expectedLog = [ @@ -73,7 +73,7 @@ public function testInvoke() (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); $this->assertEquals( - ['invokable::__invoke', 'invokable'], + ['invokable::__invoke', 'invokable:__invoke', 'invokable'], array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0)) ); }