Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee44903

Browse files
committed
[HttpKernel] Fix services are no longer injected into __invoke controllers method
1 parent1403112 commitee44903

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

‎src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
3333
{
3434
private$resolverServiceId;
3535
private$controllerTag;
36+
private$controllerLocator;
3637

37-
publicfunction__construct(string$resolverServiceId ='argument_resolver.service',string$controllerTag ='controller.service_arguments')
38+
publicfunction__construct(string$resolverServiceId ='argument_resolver.service',string$controllerTag ='controller.service_arguments',string$controllerLocator ='argument_resolver.controller_locator')
3839
{
3940
$this->resolverServiceId =$resolverServiceId;
4041
$this->controllerTag =$controllerTag;
42+
$this->controllerLocator =$controllerLocator;
4143
}
4244

4345
publicfunctionprocess(ContainerBuilder$container)
@@ -179,6 +181,8 @@ public function process(ContainerBuilder $container)
179181
}
180182

181183
$container->getDefinition($this->resolverServiceId)
182-
->replaceArgument(0, ServiceLocatorTagPass::register($container,$controllers));
184+
->replaceArgument(0,$controllerLocatorRef = ServiceLocatorTagPass::register($container,$controllers));
185+
186+
$container->setAlias($this->controllerLocator, (string)$controllerLocatorRef);
183187
}
184188
}

‎src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,16 @@
2121
*/
2222
class RemoveEmptyControllerArgumentLocatorsPassimplements CompilerPassInterface
2323
{
24-
private$resolverServiceId;
24+
private$controllerLocator;
2525

26-
publicfunction__construct(string$resolverServiceId ='argument_resolver.service')
26+
publicfunction__construct(string$controllerLocator ='argument_resolver.controller_locator')
2727
{
28-
$this->resolverServiceId =$resolverServiceId;
28+
$this->controllerLocator =$controllerLocator;
2929
}
3030

3131
publicfunctionprocess(ContainerBuilder$container)
3232
{
33-
if (false ===$container->hasDefinition($this->resolverServiceId)) {
34-
return;
35-
}
36-
37-
$serviceResolver =$container->getDefinition($this->resolverServiceId);
38-
$controllerLocator =$container->getDefinition((string)$serviceResolver->getArgument(0));
33+
$controllerLocator =$container->findDefinition($this->controllerLocator);
3934
$controllers =$controllerLocator->getArgument(0);
4035

4136
foreach ($controllersas$controller =>$argumentRef) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp