@@ -60,9 +60,6 @@ public function load(array $configs, ContainerBuilder $container)
60
60
// will be used and everything will still work as expected.
61
61
$ loader ->load ('translation.xml ' );
62
62
63
- // Property access is used by both the Form and the Validator component
64
- $ loader ->load ('property_access.xml ' );
65
-
66
63
$ configuration = $ this ->getConfiguration ($ configs , $ container );
67
64
$ config = $ this ->processConfiguration ($ configuration , $ configs );
68
65
@@ -126,7 +123,7 @@ public function load(array $configs, ContainerBuilder $container)
126
123
}
127
124
128
125
$ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ loader );
129
- $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container );
126
+ $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container, $ loader );
130
127
131
128
if (isset ($ config ['serializer ' ])) {
132
129
$ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ loader );
@@ -781,8 +778,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
781
778
}
782
779
}
783
780
784
- private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container )
781
+ private function registerPropertyAccessConfiguration (array $ config , ContainerBuilder $ container, XmlFileLoader $ loader )
785
782
{
783
+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
784
+ return ;
785
+ }
786
+
787
+ $ loader ->load ('property_access.xml ' );
788
+
786
789
$ container
787
790
->getDefinition ('property_accessor ' )
788
791
->replaceArgument (0 , $ config ['magic_call ' ])
@@ -813,6 +816,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
813
816
$ loader ->load ('serializer.xml ' );
814
817
$ chainLoader = $ container ->getDefinition ('serializer.mapping.chain_loader ' );
815
818
819
+ if (!class_exists ('Symfony\Component\PropertyAccess\PropertyAccessor ' )) {
820
+ $ container ->removeAlias ('serializer.property_accessor ' );
821
+ $ container ->removeDefinition ('serializer.normalizer.object ' );
822
+ }
823
+
816
824
$ serializerLoaders = array ();
817
825
if (isset ($ config ['enable_annotations ' ]) && $ config ['enable_annotations ' ]) {
818
826
$ annotationLoader = new Definition (
0 commit comments