@@ -159,11 +159,6 @@ public function load(array $configs, ContainerBuilder $container)
159
159
}
160
160
}
161
161
162
- // Property access is used by both the Form and the Validator component
163
- $ loader ->load ('property_access.xml ' );
164
-
165
- $ container ->getDefinition ('property_accessor ' )->setPrivate (true );
166
-
167
162
// Load Cache configuration first as it is used by other components
168
163
$ loader ->load ('cache.xml ' );
169
164
@@ -287,7 +282,7 @@ public function load(array $configs, ContainerBuilder $container)
287
282
$ this ->registerDebugConfiguration ($ config ['php_errors ' ], $ container , $ loader );
288
283
$ this ->registerRouterConfiguration ($ config ['router ' ], $ container , $ loader );
289
284
$ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ loader );
290
- $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container );
285
+ $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container, $ loader );
291
286
292
287
if ($ this ->isConfigEnabled ($ container , $ config ['serializer ' ])) {
293
288
$ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ loader );
@@ -1377,8 +1372,16 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
1377
1372
}
1378
1373
}
1379
1374
1380
- private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container )
1375
+ private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container, XmlFileLoader $ loader )
1381
1376
{
1377
+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
1378
+ return ;
1379
+ }
1380
+
1381
+ $ loader ->load ('property_access.xml ' );
1382
+
1383
+ $ container ->getDefinition ('property_accessor ' )->setPrivate (true );
1384
+
1382
1385
$ container
1383
1386
->getDefinition ('property_accessor ' )
1384
1387
->replaceArgument (0 , $ config ['magic_call ' ])
@@ -1416,6 +1419,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
1416
1419
1417
1420
$ chainLoader = $ container ->getDefinition ('serializer.mapping.chain_loader ' );
1418
1421
1422
+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
1423
+ $ container ->removeAlias ('serializer.property_accessor ' );
1424
+ $ container ->removeDefinition ('serializer.normalizer.object ' );
1425
+ }
1426
+
1419
1427
$ serializerLoaders = array ();
1420
1428
if (isset ($ config ['enable_annotations ' ]) && $ config ['enable_annotations ' ]) {
1421
1429
if (!$ this ->annotationsConfigEnabled ) {
0 commit comments