[FrameworkBundle][Serializer] Remove YamlEncoder definition if Yaml component isn't installed

This commit is contained in:
Maxime Steinhausser 2017-11-27 18:35:30 +01:00
parent 8555c0b550
commit a44f8a5b1a

View File

@ -56,6 +56,7 @@ use Symfony\Component\Validator\ConstraintValidatorInterface;
use Symfony\Component\Validator\ObjectInitializerInterface; use Symfony\Component\Validator\ObjectInitializerInterface;
use Symfony\Component\WebLink\HttpHeaderSerializer; use Symfony\Component\WebLink\HttpHeaderSerializer;
use Symfony\Component\Workflow; use Symfony\Component\Workflow;
use Symfony\Component\Yaml\Yaml;
/** /**
* FrameworkExtension. * FrameworkExtension.
@ -1172,6 +1173,10 @@ class FrameworkExtension extends Extension
$container->removeDefinition('serializer.normalizer.object'); $container->removeDefinition('serializer.normalizer.object');
} }
if (!class_exists(Yaml::class)) {
$container->removeDefinition('serializer.encoder.yaml');
}
$serializerLoaders = array(); $serializerLoaders = array();
if (isset($config['enable_annotations']) && $config['enable_annotations']) { if (isset($config['enable_annotations']) && $config['enable_annotations']) {
if (!$this->annotationsConfigEnabled) { if (!$this->annotationsConfigEnabled) {