@@ -102,9 +102,6 @@ public function load(array $configs, ContainerBuilder $container)
102102 $ loader ->load ('console.xml ' );
103103 }
104104
105- // Property access is used by both the Form and the Validator component
106- $ loader ->load ('property_access.xml ' );
107-
108105 // Load Cache configuration first as it is used by other components
109106 $ loader ->load ('cache.xml ' );
110107
@@ -216,7 +213,7 @@ public function load(array $configs, ContainerBuilder $container)
216213 }
217214
218215 $ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ loader );
219- $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container );
216+ $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container, $ loader );
220217
221218 if ($ this ->isConfigEnabled ($ container , $ config ['serializer ' ])) {
222219 $ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ loader );
@@ -1124,8 +1121,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
11241121 }
11251122 }
11261123
1127- private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container )
1124+ private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container, XmlFileLoader $ loader )
11281125 {
1126+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
1127+ return ;
1128+ }
1129+
1130+ $ loader ->load ('property_access.xml ' );
1131+
11291132 $ container
11301133 ->getDefinition ('property_accessor ' )
11311134 ->replaceArgument (0 , $ config ['magic_call ' ])
@@ -1156,6 +1159,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
11561159 $ loader ->load ('serializer.xml ' );
11571160 $ chainLoader = $ container ->getDefinition ('serializer.mapping.chain_loader ' );
11581161
1162+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
1163+ $ container ->removeAlias ('serializer.property_accessor ' );
1164+ $ container ->removeDefinition ('serializer.normalizer.object ' );
1165+ }
1166+
11591167 $ serializerLoaders = array ();
11601168 if (isset ($ config ['enable_annotations ' ]) && $ config ['enable_annotations ' ]) {
11611169 if (!$ this ->annotationsConfigEnabled ) {
0 commit comments