From fa3da4e72c0027efd3b22323439416a916381229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sun, 14 Oct 2018 20:48:28 +0200 Subject: [PATCH] [FWBundle] Uniformize errors when a component is missing --- .../FrameworkExtension.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index cc23e811f7..64a1e4c735 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -182,7 +182,7 @@ class FrameworkExtension extends Extension // translator will be used and everything will still work as expected. if ($this->isConfigEnabled($container, $config['translator']) || $this->isConfigEnabled($container, $config['form']) || $this->isConfigEnabled($container, $config['validation'])) { if (!class_exists('Symfony\Component\Translation\Translator') && $this->isConfigEnabled($container, $config['translator'])) { - throw new LogicException('Translation support cannot be enabled as the Translation component is not installed.'); + throw new LogicException('Translation support cannot be enabled as the Translation component is not installed. Try running "composer require symfony/translation".'); } if (class_exists(Translator::class)) { @@ -241,7 +241,7 @@ class FrameworkExtension extends Extension if ($this->isConfigEnabled($container, $config['form'])) { if (!class_exists('Symfony\Component\Form\Form')) { - throw new LogicException('Form support cannot be enabled as the Form component is not installed.'); + throw new LogicException('Form support cannot be enabled as the Form component is not installed. Try running "composer require symfony/form".'); } $this->formConfigEnabled = true; @@ -261,7 +261,7 @@ class FrameworkExtension extends Extension if ($this->isConfigEnabled($container, $config['assets'])) { if (!class_exists('Symfony\Component\Asset\Package')) { - throw new LogicException('Asset support cannot be enabled as the Asset component is not installed.'); + throw new LogicException('Asset support cannot be enabled as the Asset component is not installed. Try running "composer require symfony/asset".'); } $this->registerAssetsConfiguration($config['assets'], $container, $loader); @@ -269,7 +269,7 @@ class FrameworkExtension extends Extension if ($this->isConfigEnabled($container, $config['templating'])) { if (!class_exists('Symfony\Component\Templating\PhpEngine')) { - throw new LogicException('Templating support cannot be enabled as the Templating component is not installed.'); + throw new LogicException('Templating support cannot be enabled as the Templating component is not installed. Try running "composer require symfony/templating".'); } $this->registerTemplatingConfiguration($config['templating'], $container, $loader); @@ -290,7 +290,7 @@ class FrameworkExtension extends Extension if ($this->isConfigEnabled($container, $config['serializer'])) { if (!class_exists('Symfony\Component\Serializer\Serializer')) { - throw new LogicException('Serializer support cannot be enabled as the Serializer component is not installed.'); + throw new LogicException('Serializer support cannot be enabled as the Serializer component is not installed. Try running "composer require symfony/serializer-pack".'); } $this->registerSerializerConfiguration($config['serializer'], $container, $loader); @@ -306,7 +306,7 @@ class FrameworkExtension extends Extension if ($this->isConfigEnabled($container, $config['web_link'])) { if (!class_exists(HttpHeaderSerializer::class)) { - throw new LogicException('WebLink support cannot be enabled as the WebLink component is not installed.'); + throw new LogicException('WebLink support cannot be enabled as the WebLink component is not installed. Try running "composer require symfony/weblink".'); } $loader->load('web_link.xml'); @@ -585,7 +585,7 @@ class FrameworkExtension extends Extension } if (!class_exists(Workflow\Workflow::class)) { - throw new LogicException('Workflow support cannot be enabled as the Workflow component is not installed.'); + throw new LogicException('Workflow support cannot be enabled as the Workflow component is not installed. Try running "composer require symfony/workflow".'); } $loader->load('workflow.xml'); @@ -688,11 +688,11 @@ class FrameworkExtension extends Extension } if (!class_exists(ExpressionLanguage::class)) { - throw new LogicException('Cannot guard workflows as the ExpressionLanguage component is not installed.'); + throw new LogicException('Cannot guard workflows as the ExpressionLanguage component is not installed. Try running "composer require symfony/expression-language".'); } if (!class_exists(Security::class)) { - throw new LogicException('Cannot guard workflows as the Security component is not installed.'); + throw new LogicException('Cannot guard workflows as the Security component is not installed. Try running "composer require symfony/security".'); } $eventName = sprintf('workflow.%s.guard.%s', $name, $transitionName); @@ -1224,7 +1224,7 @@ class FrameworkExtension extends Extension } if (!class_exists('Symfony\Component\Validator\Validation')) { - throw new LogicException('Validation support cannot be enabled as the Validator component is not installed.'); + throw new LogicException('Validation support cannot be enabled as the Validator component is not installed. Try running "composer require symfony/validator".'); } $loader->load('validator.xml');