minor #28867 [FWBundle] Uniformize errors when a component is missing (dunglas)
This PR was merged into the 3.4 branch.
Discussion
----------
[FWBundle] Uniformize errors when a component is missing
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
fa3da4e72c
[FWBundle] Uniformize errors when a component is missing
This commit is contained in:
commit
dc11f7b30a
@ -182,7 +182,7 @@ class FrameworkExtension extends Extension
|
|||||||
// translator will be used and everything will still work as expected.
|
// 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 ($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'])) {
|
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)) {
|
if (class_exists(Translator::class)) {
|
||||||
@ -241,7 +241,7 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
if ($this->isConfigEnabled($container, $config['form'])) {
|
if ($this->isConfigEnabled($container, $config['form'])) {
|
||||||
if (!class_exists('Symfony\Component\Form\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;
|
$this->formConfigEnabled = true;
|
||||||
@ -261,7 +261,7 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
if ($this->isConfigEnabled($container, $config['assets'])) {
|
if ($this->isConfigEnabled($container, $config['assets'])) {
|
||||||
if (!class_exists('Symfony\Component\Asset\Package')) {
|
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);
|
$this->registerAssetsConfiguration($config['assets'], $container, $loader);
|
||||||
@ -269,7 +269,7 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
if ($this->isConfigEnabled($container, $config['templating'])) {
|
if ($this->isConfigEnabled($container, $config['templating'])) {
|
||||||
if (!class_exists('Symfony\Component\Templating\PhpEngine')) {
|
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);
|
$this->registerTemplatingConfiguration($config['templating'], $container, $loader);
|
||||||
@ -290,7 +290,7 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
if ($this->isConfigEnabled($container, $config['serializer'])) {
|
if ($this->isConfigEnabled($container, $config['serializer'])) {
|
||||||
if (!class_exists('Symfony\Component\Serializer\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);
|
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
|
||||||
@ -306,7 +306,7 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
if ($this->isConfigEnabled($container, $config['web_link'])) {
|
if ($this->isConfigEnabled($container, $config['web_link'])) {
|
||||||
if (!class_exists(HttpHeaderSerializer::class)) {
|
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');
|
$loader->load('web_link.xml');
|
||||||
@ -585,7 +585,7 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!class_exists(Workflow\Workflow::class)) {
|
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');
|
$loader->load('workflow.xml');
|
||||||
@ -688,11 +688,11 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!class_exists(ExpressionLanguage::class)) {
|
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)) {
|
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);
|
$eventName = sprintf('workflow.%s.guard.%s', $name, $transitionName);
|
||||||
@ -1224,7 +1224,7 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!class_exists('Symfony\Component\Validator\Validation')) {
|
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');
|
$loader->load('validator.xml');
|
||||||
|
Reference in New Issue
Block a user