[FWBundle] Uniformize errors when a component is missing

This commit is contained in:
Kévin Dunglas 2018-10-14 20:48:28 +02:00
parent 55978d793f
commit fa3da4e72c
No known key found for this signature in database
GPG Key ID: 4D04EBEF06AAF3A6

View File

@ -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');