Skip to content

Commit d400883

Browse files
committed
Display a nice error message if the form/serializer component is missing.
1 parent 382a232 commit d400883

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ public function load(array $configs, ContainerBuilder $container)
171171
}
172172

173173
if ($this->isConfigEnabled($container, $config['form'])) {
174+
if (!class_exists('Symfony\Component\Form\Form')) {
175+
throw new LogicException('Form support cannot be enabled as the Form component is not installed.');
176+
}
177+
174178
$this->formConfigEnabled = true;
175179
$this->registerFormConfiguration($config, $container, $loader);
176180
$config['validation']['enabled'] = true;
@@ -216,6 +220,10 @@ public function load(array $configs, ContainerBuilder $container)
216220
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
217221

218222
if ($this->isConfigEnabled($container, $config['serializer'])) {
223+
if (!class_exists('Symfony\Component\Serializer\Serializer')) {
224+
throw new LogicException('Serializer support cannot be enabled as the Serializer component is not installed.');
225+
}
226+
219227
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
220228
}
221229

0 commit comments

Comments
 (0)