@@ -60,9 +60,6 @@ public function load(array $configs, ContainerBuilder $container)
6060 // will be used and everything will still work as expected.
6161 $ loader ->load ('translation.xml ' );
6262
63- // Property access is used by both the Form and the Validator component
64- $ loader ->load ('property_access.xml ' );
65-
6663 $ configuration = $ this ->getConfiguration ($ configs , $ container );
6764 $ config = $ this ->processConfiguration ($ configuration , $ configs );
6865
@@ -126,7 +123,7 @@ public function load(array $configs, ContainerBuilder $container)
126123 }
127124
128125 $ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ loader );
129- $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container );
126+ $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container, $ loader );
130127
131128 if (isset ($ config ['serializer ' ])) {
132129 $ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ loader );
@@ -781,8 +778,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
781778 }
782779 }
783780
784- private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container )
781+ private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container, XmlFileLoader $ loader )
785782 {
783+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
784+ return ;
785+ }
786+
787+ $ loader ->load ('property_access.xml ' );
788+
786789 $ container
787790 ->getDefinition ('property_accessor ' )
788791 ->replaceArgument (0 , $ config ['magic_call ' ])
@@ -813,6 +816,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
813816 $ loader ->load ('serializer.xml ' );
814817 $ chainLoader = $ container ->getDefinition ('serializer.mapping.chain_loader ' );
815818
819+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
820+ $ container ->removeAlias ('serializer.property_accessor ' );
821+ $ container ->removeDefinition ('serializer.normalizer.object ' );
822+ }
823+
816824 $ serializerLoaders = array ();
817825 if (isset ($ config ['enable_annotations ' ]) && $ config ['enable_annotations ' ]) {
818826 $ annotationLoader = new Definition (
0 commit comments