@@ -159,11 +159,13 @@ private function registerCommonConfiguration(ContainerBuilder $container, array
159
159
$ loader ->load ('legacy/backward_compatibility.xml ' );
160
160
} else {
161
161
$ loader ->load ('v3/api.xml ' );
162
+ $ loader ->load ('legacy/data_provider.xml ' );
163
+ $ loader ->load ('v3/state.xml ' );
164
+ $ loader ->load ('v3/backward_compatibility.xml ' );
162
165
}
163
166
164
167
$ loader ->load ('data_persister.xml ' );
165
168
$ loader ->load ('data_provider.xml ' );
166
- $ loader ->load ('state.xml ' );
167
169
$ loader ->load ('filter.xml ' );
168
170
169
171
if ($ container ->hasDefinition ('api_platform.operation_method_resolver ' )) {
@@ -307,25 +309,24 @@ private function registerMetadataConfiguration(ContainerBuilder $container, arra
307
309
$ container ->getDefinition ('api_platform.metadata.resource_extractor.xml ' )->replaceArgument (0 , $ xmlResources );
308
310
$ container ->getDefinition ('api_platform.metadata.property_extractor.xml ' )->replaceArgument (0 , $ xmlResources );
309
311
310
- if ($ config ['metadata_backward_compatibility_layer ' ]) {
311
- $ loader ->load ('legacy/metadata.xml ' );
312
- $ container ->getDefinition ('api_platform.metadata.extractor.xml.legacy ' )->replaceArgument (0 , $ xmlResources );
312
+ $ loader ->load ('legacy/metadata.xml ' );
313
+ $ container ->getDefinition ('api_platform.metadata.extractor.xml.legacy ' )->replaceArgument (0 , $ xmlResources );
313
314
314
- if (class_exists (Annotation::class)) {
315
- $ loader ->load ('legacy/metadata_annotation.xml ' );
316
- }
315
+ if (class_exists (Annotation::class)) {
316
+ $ loader ->load ('legacy/metadata_annotation.xml ' );
317
+ }
317
318
318
- if (interface_exists (DocBlockFactoryInterface::class)) {
319
- $ loader ->load ('legacy/metadata_php_doc.xml ' );
320
- }
319
+ if (interface_exists (DocBlockFactoryInterface::class)) {
320
+ $ loader ->load ('legacy/metadata_php_doc.xml ' );
321
+ }
321
322
322
- if (class_exists (Yaml::class)) {
323
- $ loader ->load ('legacy/metadata_yaml.xml ' );
324
- $ container ->getDefinition ('api_platform.metadata.extractor.yaml.legacy ' )->replaceArgument (0 , $ yamlResources );
325
- }
326
- } else {
327
- // Load the legacy metadata as well
323
+ if (class_exists (Yaml::class)) {
324
+ $ loader ->load ('legacy/metadata_yaml.xml ' );
325
+ $ container ->getDefinition ('api_platform.metadata.extractor.yaml.legacy ' )->replaceArgument (0 , $ yamlResources );
326
+ }
328
327
328
+ // Load the legacy metadata as well
329
+ if (!$ config ['metadata_backward_compatibility_layer ' ]) {
329
330
$ loader ->load ('metadata/links.xml ' );
330
331
$ loader ->load ('metadata/property.xml ' );
331
332
$ loader ->load ('metadata/property_name.xml ' );
@@ -339,14 +340,8 @@ private function registerMetadataConfiguration(ContainerBuilder $container, arra
339
340
$ loader ->load ('metadata/yaml.xml ' );
340
341
$ container ->getDefinition ('api_platform.metadata.resource_extractor.yaml ' )->replaceArgument (0 , $ yamlResources );
341
342
$ container ->getDefinition ('api_platform.metadata.property_extractor.yaml ' )->replaceArgument (0 , $ yamlResources );
343
+ $ loader ->load ('metadata/backward_compatibility.xml ' );
342
344
}
343
-
344
- // TODO: remove in 3.0 legacy metadata
345
- // if ($config['metadata_backward_compatibility_layer']) {
346
- // $container->removeDefinition('api_platform.metadata.property.metadata_factory');
347
- // $container->setAlias('api_platform.metadata.property.metadata_factory', 'api_platform.metadata.property.metadata_factory.legacy');
348
- // }
349
-
350
345
}
351
346
352
347
private function getBundlesResourcesPaths (ContainerBuilder $ container , array $ config ): array
@@ -453,7 +448,7 @@ private function registerSwaggerConfiguration(ContainerBuilder $container, array
453
448
}
454
449
455
450
$ loader ->load ('openapi.xml ' );
456
- $ loader ->load ('swagger-ui .xml ' );
451
+ $ loader ->load ('swagger_ui .xml ' );
457
452
458
453
if (!$ config ['enable_swagger_ui ' ] && !$ config ['enable_re_doc ' ]) {
459
454
// Remove the listener but keep the controller to allow customizing the path of the UI
@@ -480,6 +475,7 @@ private function registerSwaggerConfiguration(ContainerBuilder $container, array
480
475
}
481
476
482
477
$ loader ->load ('v3/openapi.xml ' );
478
+ $ loader ->load ('v3/swagger_ui.xml ' );
483
479
}
484
480
485
481
private function registerJsonApiConfiguration (array $ formats , XmlFileLoader $ loader ): void
@@ -621,10 +617,7 @@ private function registerDoctrineOrmConfiguration(ContainerBuilder $container, a
621
617
->setBindings (['$requestStack ' => null ]);
622
618
623
619
$ loader ->load ('doctrine_orm.xml ' );
624
-
625
- if ($ config ['metadata_backward_compatibility_layer ' ]) {
626
- $ loader ->load ('legacy/doctrine_orm.xml ' );
627
- }
620
+ $ loader ->load ('legacy/doctrine_orm.xml ' );
628
621
629
622
if ($ this ->isConfigEnabled ($ container , $ config ['eager_loading ' ])) {
630
623
return ;
@@ -650,10 +643,7 @@ private function registerDoctrineMongoDbOdmConfiguration(ContainerBuilder $conta
650
643
->setBindings (['$managerRegistry ' => new Reference ('doctrine_mongodb ' )]);
651
644
652
645
$ loader ->load ('doctrine_mongodb_odm.xml ' );
653
-
654
- if ($ config ['metadata_backward_compatibility_layer ' ]) {
655
- $ loader ->load ('legacy/doctrine_odm.xml ' );
656
- }
646
+ $ loader ->load ('legacy/doctrine_odm.xml ' );
657
647
}
658
648
659
649
private function registerHttpCacheConfiguration (ContainerBuilder $ container , array $ config , XmlFileLoader $ loader ): void
@@ -693,12 +683,6 @@ private function registerHttpCacheConfiguration(ContainerBuilder $container, arr
693
683
$ config ['http_cache ' ]['invalidation ' ]['max_header_length ' ], ]);
694
684
$ container ->setAlias ('api_platform.http_cache.purger.xkey ' , 'api_platform.http_cache.purger.varnish.xkey ' );
695
685
}
696
-
697
- if ($ config ['metadata_backward_compatibility_layer ' ]) {
698
- // $definition = $container->getDefinition('api_platform.http_cache.listener.response.add_tags');
699
- // $definition->setArgument(0, new Reference('api_platform.iri_converter.legacy'));
700
- // $definition->setArgument(1, null);
701
- }
702
686
}
703
687
704
688
/**
@@ -760,6 +744,12 @@ private function registerDataCollectorConfiguration(ContainerBuilder $container,
760
744
761
745
if ($ container ->hasParameter ('kernel.debug ' ) && $ container ->getParameter ('kernel.debug ' )) {
762
746
$ loader ->load ('debug.xml ' );
747
+
748
+ if ($ config ['metadata_backward_compatibility_layer ' ]) {
749
+ $ loader ->load ('legacy/debug.xml ' );
750
+ } else {
751
+ $ loader ->load ('v3/debug.xml ' );
752
+ }
763
753
}
764
754
}
765
755
@@ -797,7 +787,11 @@ private function registerMercureConfiguration(ContainerBuilder $container, array
797
787
}
798
788
799
789
if ($ this ->isConfigEnabled ($ container , $ config ['graphql ' ])) {
800
- $ loader ->load ('graphql_mercure.xml ' );
790
+ if ($ config ['metadata_backward_compatibility_layer ' ]) {
791
+ $ loader ->load ('legacy/graphql_mercure.xml ' );
792
+ } else {
793
+ $ loader ->load ('v3/graphql_mercure.xml ' );
794
+ }
801
795
if (class_exists (HubRegistry::class)) {
802
796
$ container ->getDefinition ('api_platform.graphql.subscription.mercure_iri_generator ' )->addArgument (new Reference (HubRegistry::class));
803
797
} else {
@@ -888,68 +882,21 @@ private function registerArgumentResolverConfiguration(ContainerBuilder $contain
888
882
return ;
889
883
}
890
884
891
- die ('wtf ' );
892
885
$ loader ->load ('argument_resolver.xml ' );
893
886
}
894
887
895
888
private function registerLegacyServices (ContainerBuilder $ container , array $ config , XmlFileLoader $ loader ): void
896
889
{
897
890
$ container ->setParameter ('api_platform.metadata_backward_compatibility_layer ' , $ config ['metadata_backward_compatibility_layer ' ]);
898
891
892
+ $ loader ->load ('legacy/identifiers.xml ' );
893
+
899
894
if (!$ config ['metadata_backward_compatibility_layer ' ]) {
900
895
$ loader ->load ('symfony.xml ' );
901
896
return ;
902
897
}
903
898
904
- $ loader ->load ('legacy/identifiers.xml ' );
905
899
$ loader ->load ('legacy/api.xml ' );
906
-
907
- // $container->removeDefinition('api_platform.iri_converter');
908
- // $container->setAlias('api_platform.iri_converter', 'api_platform.iri_converter.legacy');
909
- // $container->removeDefinition('api_platform.route_loader');
910
- // $container->setAlias('api_platform.route_loader', 'api_platform.route_loader.legacy');
911
- // $container->removeDefinition('api_platform.operation_path_resolver');
912
- //
913
- // $container->removeAlias('api_platform.identifiers_extractor');
914
- // $container->setAlias('api_platform.identifiers_extractor', 'api_platform.identifiers_extractor.legacy');
915
- //
916
- // $container->removeAlias('api_platform.iri_converter');
917
- // $container->setAlias('api_platform.iri_converter', 'api_platform.iri_converter.legacy');
918
- //
919
- // $container->removeAlias('api_platform.openapi.factory');
920
- // $container->setAlias('api_platform.openapi.factory', 'api_platform.openapi.factory.legacy');
921
- //
922
- // $container->removeAlias('api_platform.graphql.resolver.stage.read');
923
- // $container->setAlias('api_platform.graphql.resolver.stage.read', 'api_platform.graphql.resolver.stage.read.legacy');
924
- //
925
- // $container->removeAlias('api_platform.graphql.resolver.stage.write');
926
- // $container->setAlias('api_platform.graphql.resolver.stage.write', 'api_platform.graphql.resolver.stage.write.legacy');
927
- //
928
- // $container->removeAlias('api_platform.graphql.type_converter');
929
- // $container->setAlias('api_platform.graphql.type_converter', 'api_platform.graphql.type_converter.legacy');
930
- //
931
- // $container->removeAlias('api_platform.graphql.type_builder');
932
- // $container->setAlias('api_platform.graphql.type_builder', 'api_platform.graphql.type_builder.legacy');
933
- //
934
- // $container->removeAlias('api_platform.graphql.fields_builder');
935
- // $container->setAlias('api_platform.graphql.fields_builder', 'api_platform.graphql.fields_builder.legacy');
936
- //
937
- // $container->removeAlias('api_platform.graphql.schema_builder');
938
- // $container->setAlias('api_platform.graphql.schema_builder', 'api_platform.graphql.schema_builder.legacy');
939
- //
940
- // $container->removeAlias('api_platform.pagination');
941
- // $container->setAlias('api_platform.pagination', 'api_platform.pagination.legacy');
942
- //
943
- // $container->removeDefinition('api_platform.metadata.resource.name_collection_factory.attributes');
944
- // $container->removeDefinition('api_platform.metadata.resource.name_collection_factory.xml');
945
- // $container->setAlias('api_platform.metadata.resource.name_collection_factory.xml', 'api_platform.metadata.resource.name_collection_factory.xml.legacy');
946
- //
947
- // $container->removeDefinition('api_platform.metadata.resource.name_collection_factory.yaml');
948
- // $container->setAlias('api_platform.metadata.resource.name_collection_factory.yaml', 'api_platform.metadata.resource.name_collection_factory.yaml.legacy');
949
- //
950
- // $container->getDefinition('api_platform.hal.normalizer.item')->setArgument(11, null);
951
- // $container->getDefinition('api_platform.graphql.normalizer.item')->setArgument(12, null);
952
- // $container->getDefinition('api_platform.http_cache.listener.response.add_tags')->setArgument(1, null);
953
900
}
954
901
955
902
private function registerRectorConfiguration (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
0 commit comments