Display a nice error message if the form/serializer component is missing.

This commit is contained in:
Alexander M. Turek 2017-11-22 00:40:17 +01:00
parent 20dd47b014
commit 2b45805e03

View File

@ -171,6 +171,10 @@ 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.');
}
$this->formConfigEnabled = true;
$this->registerFormConfiguration($config, $container, $loader);
$config['validation']['enabled'] = true;
@ -216,6 +220,10 @@ class FrameworkExtension extends Extension
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
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.');
}
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
}