Skip to content

Commit

Permalink
[DI] Fix dumping Doctrine-like service graphs (bis)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Feb 6, 2019
1 parent 205b0ba commit ff3d5ee
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -661,7 +661,6 @@ private function addService($id, Definition $definition, &$file = null)
$autowired = $definition->isAutowired() ? ' autowired' : '';

if ($definition->isLazy()) {
unset($this->circularReferences[$id]);
$lazyInitialization = '$lazyLoad = true';
} else {
$lazyInitialization = '';
Expand Down Expand Up @@ -807,11 +806,13 @@ private function addInlineService($id, Definition $definition, Definition $inlin

if ('instance' === $name) {
$code .= $this->addServiceInstance($id, $definition, $isSimpleInstance);
$forConstructor = false;
} else {
$code .= $this->addNewInstance($inlineDef, '$'.$name, ' = ', $id);
$forConstructor = $forConstructor && $this->proxyDumper instanceof NullDumper && $this->container->getDefinition($id)->isLazy();
}

if ('' !== $inline = $this->addInlineVariables($id, $definition, $arguments, false)) {
if ('' !== $inline = $this->addInlineVariables($id, $definition, $arguments, $forConstructor)) {
$code .= "\n".$inline."\n";
} elseif ($arguments && 'instance' === $name) {
$code .= "\n";
Expand Down

0 comments on commit ff3d5ee

Please sign in to comment.