@@ -63,9 +63,6 @@ public function load(array $configs, ContainerBuilder $container)
6363 // will be used and everything will still work as expected.
6464 $ loader ->load ('translation.xml ' );
6565
66- // Property access is used by both the Form and the Validator component
67- $ loader ->load ('property_access.xml ' );
68-
6966 $ configuration = $ this ->getConfiguration ($ configs , $ container );
7067 $ config = $ this ->processConfiguration ($ configuration , $ configs );
7168
@@ -129,7 +126,7 @@ public function load(array $configs, ContainerBuilder $container)
129126 }
130127
131128 $ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ loader );
132- $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container );
129+ $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container, $ loader );
133130
134131 if (isset ($ config ['serializer ' ])) {
135132 $ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ loader );
@@ -852,8 +849,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
852849 }
853850 }
854851
855- private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container )
852+ private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container, XmlFileLoader $ loader )
856853 {
854+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
855+ return ;
856+ }
857+
858+ $ loader ->load ('property_access.xml ' );
859+
857860 $ container
858861 ->getDefinition ('property_accessor ' )
859862 ->replaceArgument (0 , $ config ['magic_call ' ])
@@ -900,6 +903,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
900903 $ loader ->load ('serializer.xml ' );
901904 $ chainLoader = $ container ->getDefinition ('serializer.mapping.chain_loader ' );
902905
906+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
907+ $ container ->removeAlias ('serializer.property_accessor ' );
908+ $ container ->removeDefinition ('serializer.normalizer.object ' );
909+ }
910+
903911 $ serializerLoaders = array ();
904912 if (isset ($ config ['enable_annotations ' ]) && $ config ['enable_annotations ' ]) {
905913 $ annotationLoader = new Definition (
0 commit comments