diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php index a1ed422f73..12be3d915f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php @@ -58,7 +58,11 @@ class AutowireExceptionPass implements CompilerPassInterface // was the service inlined? Of so, does its parent service exist? if (isset($inlinedIds[$serviceId])) { - return $this->doesServiceExistInTheContainer($inlinedIds[$serviceId], $container, $inlinedIds); + foreach ($inlinedIds[$serviceId] as $parentId) { + if ($this->doesServiceExistInTheContainer($parentId, $container, $inlinedIds)) { + return true; + } + } } return false; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index a2eb511c64..7a5da70d09 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -36,7 +36,7 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe /** * Returns an array of all services inlined by this pass. * - * The key is the inlined service id and its value is the service it was inlined into. + * The key is the inlined service id and its value is the list of services it was inlined into. * * @return array */ @@ -59,7 +59,7 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe if ($this->isInlineableDefinition($id, $definition, $this->container->getCompiler()->getServiceReferenceGraph())) { $this->container->log($this, sprintf('Inlined service "%s" to "%s".', $id, $this->currentId)); - $this->inlinedServiceIds[$id] = $this->currentId; + $this->inlinedServiceIds[$id][] = $this->currentId; if ($definition->isShared()) { return $definition; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php index 8cd03f578a..4f0b3d6c25 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php @@ -65,9 +65,9 @@ class AutowireExceptionPassTest extends TestCase ->method('getInlinedServiceIds') ->will($this->returnValue(array( // a_service inlined into b_service - 'a_service' => 'b_service', + 'a_service' => array('b_service'), // b_service inlined into c_service - 'b_service' => 'c_service', + 'b_service' => array('c_service'), ))); $container = new ContainerBuilder(); @@ -100,9 +100,9 @@ class AutowireExceptionPassTest extends TestCase ->method('getInlinedServiceIds') ->will($this->returnValue(array( // a_service inlined into b_service - 'a_service' => 'b_service', + 'a_service' => array('b_service'), // b_service inlined into c_service - 'b_service' => 'c_service', + 'b_service' => array('c_service'), ))); // do NOT register c_service in the container diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php index 0eaea411f1..f0dd7fe74d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php @@ -273,7 +273,7 @@ class InlineServiceDefinitionsPassTest extends TestCase $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), $inlinePass)); $repeatedPass->process($container); - $this->assertEquals(array('inlinable.service' => 'other_service'), $inlinePass->getInlinedServiceIds()); + $this->assertEquals(array('inlinable.service' => array('other_service')), $inlinePass->getInlinedServiceIds()); } protected function process(ContainerBuilder $container)