@@ -63,9 +63,6 @@ public function load(array $configs, ContainerBuilder $container)
63
63
// will be used and everything will still work as expected.
64
64
$ loader ->load ('translation.xml ' );
65
65
66
- // Property access is used by both the Form and the Validator component
67
- $ loader ->load ('property_access.xml ' );
68
-
69
66
$ configuration = $ this ->getConfiguration ($ configs , $ container );
70
67
$ config = $ this ->processConfiguration ($ configuration , $ configs );
71
68
@@ -129,7 +126,7 @@ public function load(array $configs, ContainerBuilder $container)
129
126
}
130
127
131
128
$ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ loader );
132
- $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container );
129
+ $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container, $ loader );
133
130
134
131
if (isset ($ config ['serializer ' ])) {
135
132
$ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ loader );
@@ -852,8 +849,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
852
849
}
853
850
}
854
851
855
- private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container )
852
+ private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container, XmlFileLoader $ loader )
856
853
{
854
+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
855
+ return ;
856
+ }
857
+
858
+ $ loader ->load ('property_access.xml ' );
859
+
857
860
$ container
858
861
->getDefinition ('property_accessor ' )
859
862
->replaceArgument (0 , $ config ['magic_call ' ])
@@ -900,6 +903,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
900
903
$ loader ->load ('serializer.xml ' );
901
904
$ chainLoader = $ container ->getDefinition ('serializer.mapping.chain_loader ' );
902
905
906
+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
907
+ $ container ->removeAlias ('serializer.property_accessor ' );
908
+ $ container ->removeDefinition ('serializer.normalizer.object ' );
909
+ }
910
+
903
911
$ serializerLoaders = array ();
904
912
if (isset ($ config ['enable_annotations ' ]) && $ config ['enable_annotations ' ]) {
905
913
$ annotationLoader = new Definition (
0 commit comments