8000 bug #25174 [Translation] modify definitions only if the do exist (xab… · symfony/symfony@3c8ff5e · GitHub
[go: up one dir, main page]

Skip to content

Commit 3c8ff5e

Browse files
committed
bug #25174 [Translation] modify definitions only if the do exist (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [Translation] modify definitions only if the do exist | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | If the `TranslatorPass` is used an application without the Console component, the commands will not be registered. Thus, their service definitions must not be modified. Commits ------- eab90ef modify definitions only if the do exist
2 parents 34b0eca + eab90ef commit 3c8ff5e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,15 @@ public function process(ContainerBuilder $container)
8080
->replaceArgument(3, $loaders)
8181
;
8282

83-
if ($container->hasParameter('twig.default_path')) {
83+
if (!$container->hasParameter('twig.default_path')) {
84+
return;
85+
}
86+
87+
if ($container->hasDefinition($this->debugCommandServiceId)) {
8488
$container->getDefinition($this->debugCommandServiceId)->replaceArgument(4, $container->getParameter('twig.default_path'));
89+
}
90+
91+
if ($container->hasDefinition($this->updateCommandServiceId)) {
8592
$container->getDefinition($this->updateCommandServiceId)->replaceArgument(5, $container->getParameter('twig.default_path'));
8693
}
8794
}

0 commit comments

Comments
 (0)
0