[FrameworkBundle] Do not load property_access.xml if the component isn't installed
This commit is contained in:
parent
bb8f1534d2
commit
d297e27600
@ -63,9 +63,6 @@ class FrameworkExtension extends Extension
|
|||||||
// will be used and everything will still work as expected.
|
// will be used and everything will still work as expected.
|
||||||
$loader->load('translation.xml');
|
$loader->load('translation.xml');
|
||||||
|
|
||||||
// Property access is used by both the Form and the Validator component
|
|
||||||
$loader->load('property_access.xml');
|
|
||||||
|
|
||||||
$configuration = $this->getConfiguration($configs, $container);
|
$configuration = $this->getConfiguration($configs, $container);
|
||||||
$config = $this->processConfiguration($configuration, $configs);
|
$config = $this->processConfiguration($configuration, $configs);
|
||||||
|
|
||||||
@ -129,7 +126,7 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
|
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
|
||||||
$this->registerPropertyAccessConfiguration($config['property_access'], $container);
|
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
|
||||||
|
|
||||||
if (isset($config['serializer'])) {
|
if (isset($config['serializer'])) {
|
||||||
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
|
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
|
||||||
@ -852,8 +849,14 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container)
|
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
|
||||||
{
|
{
|
||||||
|
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$loader->load('property_access.xml');
|
||||||
|
|
||||||
$container
|
$container
|
||||||
->getDefinition('property_accessor')
|
->getDefinition('property_accessor')
|
||||||
->replaceArgument(0, $config['magic_call'])
|
->replaceArgument(0, $config['magic_call'])
|
||||||
@ -900,6 +903,11 @@ class FrameworkExtension extends Extension
|
|||||||
$loader->load('serializer.xml');
|
$loader->load('serializer.xml');
|
||||||
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
|
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
|
||||||
|
|
||||||
|
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
|
||||||
|
$container->removeAlias('serializer.property_accessor');
|
||||||
|
$container->removeDefinition('serializer.normalizer.object');
|
||||||
|
}
|
||||||
|
|
||||||
$serializerLoaders = array();
|
$serializerLoaders = array();
|
||||||
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
|
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
|
||||||
$annotationLoader = new Definition(
|
$annotationLoader = new Definition(
|
||||||
|
Reference in New Issue
Block a user