Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff3d5ee

Browse files
[DI] Fix dumping Doctrine-like service graphs (bis)
1 parent 205b0ba commit ff3d5ee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,6 @@ private function addService($id, Definition $definition, &$file = null)
661661
$autowired = $definition->isAutowired() ? ' autowired' : '';
662662

663663
if ($definition->isLazy()) {
664-
unset($this->circularReferences[$id]);
665664
$lazyInitialization = '$lazyLoad = true';
666665
} else {
667666
$lazyInitialization = '';
@@ -807,11 +806,13 @@ private function addInlineService($id, Definition $definition, Definition $inlin
807806

808807
if ('instance' === $name) {
809808
$code .= $this->addServiceInstance($id, $definition, $isSimpleInstance);
809+
$forConstructor = false;
810810
} else {
811811
$code .= $this->addNewInstance($inlineDef, '$'.$name, ' = ', $id);
812+
$forConstructor = $forConstructor && $this->proxyDumper instanceof NullDumper && $this->container->getDefinition($id)->isLazy();
812813
}
813814

814-
if ('' !== $inline = $this->addInlineVariables($id, $definition, $arguments, false)) {
815+
if ('' !== $inline = $this->addInlineVariables($id, $definition, $arguments, $forConstructor)) {
815816
$code .= "\n".$inline."\n";
816817
} elseif ($arguments && 'instance' === $name) {
817818
$code .= "\n";

0 commit comments

Comments
 (0)