@@ -102,9 +102,6 @@ public function load(array $configs, ContainerBuilder $container)
102
102
$ loader ->load ('console.xml ' );
103
103
}
104
104
105
- // Property access is used by both the Form and the Validator component
106
- $ loader ->load ('property_access.xml ' );
107
-
108
105
// Load Cache configuration first as it is used by other components
109
106
$ loader ->load ('cache.xml ' );
110
107
@@ -216,7 +213,7 @@ public function load(array $configs, ContainerBuilder $container)
216
213
}
217
214
218
215
$ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ loader );
219
- $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container );
216
+ $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container, $ loader );
220
217
221
218
if ($ this ->isConfigEnabled ($ container , $ config ['serializer ' ])) {
222
219
$ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ loader );
@@ -1124,8 +1121,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
1124
1121
}
1125
1122
}
1126
1123
1127
- private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container )
1124
+ private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container, XmlFileLoader $ loader )
1128
1125
{
1126
+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
1127
+ return ;
1128
+ }
1129
+
1130
+ $ loader ->load ('property_access.xml ' );
1131
+
1129
1132
$ container
1130
1133
->getDefinition ('property_accessor ' )
1131
1134
->replaceArgument (0 , $ config ['magic_call ' ])
@@ -1156,6 +1159,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
1156
1159
$ loader ->load ('serializer.xml ' );
1157
1160
$ chainLoader = $ container ->getDefinition ('serializer.mapping.chain_loader ' );
1158
1161
1162
+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
1163
+ $ container ->removeAlias ('serializer.property_accessor ' );
1164
+ $ container ->removeDefinition ('serializer.normalizer.object ' );
1165
+ }
1166
+
1159
1167
$ serializerLoaders = array ();
1160
1168
if (isset ($ config ['enable_annotations ' ]) && $ config ['enable_annotations ' ]) {
1161
1169
if (!$ this ->annotationsConfigEnabled ) {
0 commit comments