8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5b86871 + 8835bbc commit 6d3e8dfCopy full SHA for 6d3e8df
DependencyInjection/RegisterControllerArgumentLocatorsPass.php
@@ -33,11 +33,13 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
33
{
34
private $resolverServiceId;
35
private $controllerTag;
36
+ private $controllerLocator;
37
- public function __construct(string $resolverServiceId = 'argument_resolver.service', string $controllerTag = 'controller.service_arguments')
38
+ public function __construct(string $resolverServiceId = 'argument_resolver.service', string $controllerTag = 'controller.service_arguments', string $controllerLocator = 'argument_resolver.controller_locator')
39
40
$this->resolverServiceId = $resolverServiceId;
41
$this->controllerTag = $controllerTag;
42
+ $this->controllerLocator = $controllerLocator;
43
}
44
45
public function process(ContainerBuilder $container)
@@ -179,6 +181,8 @@ public function process(ContainerBuilder $container)
179
181
180
182
183
$container->getDefinition($this->resolverServiceId)
- ->replaceArgument(0, ServiceLocatorTagPass::register($container, $controllers));
184
+ ->replaceArgument(0, $controllerLocatorRef = ServiceLocatorTagPass::register($container, $controllers));
185
+
186
+ $container->setAlias($this->controllerLocator, (string) $controllerLocatorRef);
187
188
DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php
@@ -21,21 +21,16 @@
21
*/
22
class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface
23
24
- private $resolverServiceId;
25
26
- public function __construct(string $resolverServiceId = 'argument_resolver.service')
+ public function __construct(string $controllerLocator = 'argument_resolver.controller_locator')
27
28
- $this->resolverServiceId = $resolverServiceId;
29
30
31
32
- if (false === $container->hasDefinition($this->resolverServiceId)) {
- return;
- }
-
- $serviceResolver = $container->getDefinition($this->resolverServiceId);
- $controllerLocator = $container->getDefinition((string) $serviceResolver->getArgument(0));
+ $controllerLocator = $container->findDefinition($this->controllerLocator);
$controllers = $controllerLocator->getArgument(0);
foreach ($controllers as $controller => $argumentRef) {