|
11 | 11 |
|
12 | 12 | namespace Symfony\Component\DependencyInjection\Compiler; |
13 | 13 |
|
| 14 | +use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; |
14 | 15 | use Symfony\Component\DependencyInjection\Definition; |
15 | 16 | use Symfony\Component\DependencyInjection\Reference; |
16 | 17 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
@@ -91,19 +92,25 @@ public function process(ContainerBuilder $container) |
91 | 92 | * Processes service definitions for arguments to find relationships for the service graph. |
92 | 93 | * |
93 | 94 | * @param array $arguments An array of Reference or Definition objects relating to service definitions |
| 95 | + * @param bool $lazy Whether the references nested in the arguments should be considered lazy or not |
94 | 96 | */ |
95 | | - private function processArguments(array $arguments) |
| 97 | + private function processArguments(array $arguments, $lazy = false) |
96 | 98 | { |
97 | 99 | foreach ($arguments as $argument) { |
98 | 100 | if (is_array($argument)) { |
99 | | - $this->processArguments($argument); |
| 101 | + $this->processArguments($argument, $lazy); |
| 102 | + } elseif ($argument instanceof ArgumentInterface) { |
| 103 | + $this->processArguments($argument->getValues(), true); |
100 | 104 | } elseif ($argument instanceof Reference) { |
| 105 | + $targetDefinition = $this->getDefinition((string) $argument); |
| 106 | + |
101 | 107 | $this->graph->connect( |
102 | 108 | $this->currentId, |
103 | 109 | $this->currentDefinition, |
104 | 110 | $this->getDefinitionId((string) $argument), |
105 | | - $this->getDefinition((string) $argument), |
106 | | - $argument |
| 111 | + $targetDefinition, |
| 112 | + $argument, |
| 113 | + $lazy || ($targetDefinition && $targetDefinition->isLazy()) |
107 | 114 | ); |
108 | 115 | } elseif ($argument instanceof Definition) { |
109 | 116 | $this->processArguments($argument->getArguments()); |
|
0 commit comments