From eab90ef1cf61b8921a50d1c0da99c9e6900ffb20 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 27 Nov 2017 15:08:03 +0100 Subject: [PATCH] modify definitions only if the do exist 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. --- .../Translation/DependencyInjection/TranslatorPass.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php b/src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php index a5e4097843..db2a2a1ecc 100644 --- a/src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php +++ b/src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php @@ -80,8 +80,15 @@ class TranslatorPass implements CompilerPassInterface ->replaceArgument(3, $loaders) ; - if ($container->hasParameter('twig.default_path')) { + if (!$container->hasParameter('twig.default_path')) { + return; + } + + if ($container->hasDefinition($this->debugCommandServiceId)) { $container->getDefinition($this->debugCommandServiceId)->replaceArgument(4, $container->getParameter('twig.default_path')); + } + + if ($container->hasDefinition($this->updateCommandServiceId)) { $container->getDefinition($this->updateCommandServiceId)->replaceArgument(5, $container->getParameter('twig.default_path')); } }