diff --git a/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php b/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php index 7ce5c65e212..b59db5afd69 100644 --- a/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php +++ b/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php @@ -59,7 +59,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Finder\Finder; use Symfony\Component\HttpClient\ScopingHttpClient; @@ -109,7 +109,7 @@ public function prepend(ContainerBuilder $container): void */ public function load(array $configs, ContainerBuilder $container): void { - $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); @@ -177,7 +177,7 @@ public function load(array $configs, ContainerBuilder $container): void $this->registerJsonStreamerConfiguration($container, $loader, $formats, $config); if (class_exists(ObjectMapper::class)) { - $loader->load('state/object_mapper.xml'); + $loader->load('state/object_mapper.php'); } $container->registerForAutoconfiguration(FilterInterface::class) ->addTag('api_platform.filter'); @@ -252,19 +252,19 @@ private function injectStopwatch(ContainerBuilder $container): void } } - private function registerCommonConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader, array $formats, array $patchFormats, array $errorFormats, array $docsFormats): void + private function registerCommonConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader, array $formats, array $patchFormats, array $errorFormats, array $docsFormats): void { - $loader->load('state/state.xml'); - $loader->load('symfony/symfony.xml'); - $loader->load('api.xml'); - $loader->load('filter.xml'); + $loader->load('state/state.php'); + $loader->load('symfony/symfony.php'); + $loader->load('api.php'); + $loader->load('filter.php'); if (class_exists(UuidDenormalizer::class) && class_exists(Uuid::class)) { - $loader->load('ramsey_uuid.xml'); + $loader->load('ramsey_uuid.php'); } if (class_exists(AbstractUid::class)) { - $loader->load('symfony/uid.xml'); + $loader->load('symfony/uid.php'); } $defaultContext = ['hydra_prefix' => $config['serializer']['hydra_prefix']] + ($container->hasParameter('serializer.default_context') ? $container->getParameter('serializer.default_context') : []); @@ -274,13 +274,13 @@ private function registerCommonConfiguration(ContainerBuilder $container, array $container->setParameter('serializer.default_context', $container->getParameter('api_platform.serializer.default_context')); } if ($config['use_symfony_listeners']) { - $loader->load('symfony/events.xml'); + $loader->load('symfony/events.php'); } else { - $loader->load('symfony/controller.xml'); - $loader->load('state/provider.xml'); - $loader->load('state/processor.xml'); + $loader->load('symfony/controller.php'); + $loader->load('state/provider.php'); + $loader->load('state/processor.php'); } - $loader->load('state/parameter_provider.xml'); + $loader->load('state/parameter_provider.php'); $container->setParameter('api_platform.enable_entrypoint', $config['enable_entrypoint']); $container->setParameter('api_platform.enable_docs', $config['enable_docs']); @@ -381,14 +381,14 @@ private function normalizeDefaults(array $defaults): array return $normalizedDefaults; } - private function registerMetadataConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerMetadataConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { [$xmlResources, $yamlResources, $phpResources] = $this->getResourcesToWatch($container, $config); $container->setParameter('api_platform.class_name_resources', $this->getClassNameResources()); - $loader->load('metadata/resource_name.xml'); - $loader->load('metadata/property_name.xml'); + $loader->load('metadata/resource_name.php'); + $loader->load('metadata/property_name.php'); if (!empty($config['resource_class_directories'])) { $container->setParameter('api_platform.resource_class_directories', array_merge( @@ -398,23 +398,23 @@ private function registerMetadataConfiguration(ContainerBuilder $container, arra } // V3 metadata - $loader->load('metadata/php.xml'); - $loader->load('metadata/xml.xml'); - $loader->load('metadata/links.xml'); - $loader->load('metadata/property.xml'); - $loader->load('metadata/resource.xml'); - $loader->load('metadata/operation.xml'); - $loader->load('metadata/mutator.xml'); + $loader->load('metadata/php.php'); + $loader->load('metadata/xml.php'); + $loader->load('metadata/links.php'); + $loader->load('metadata/property.php'); + $loader->load('metadata/resource.php'); + $loader->load('metadata/operation.php'); + $loader->load('metadata/mutator.php'); $container->getDefinition('api_platform.metadata.resource_extractor.xml')->replaceArgument(0, $xmlResources); $container->getDefinition('api_platform.metadata.property_extractor.xml')->replaceArgument(0, $xmlResources); if (class_exists(PhpDocParser::class)) { - $loader->load('metadata/php_doc.xml'); + $loader->load('metadata/php_doc.php'); } if (class_exists(Yaml::class)) { - $loader->load('metadata/yaml.xml'); + $loader->load('metadata/yaml.php'); $container->getDefinition('api_platform.metadata.resource_extractor.yaml')->replaceArgument(0, $yamlResources); $container->getDefinition('api_platform.metadata.property_extractor.yaml')->replaceArgument(0, $yamlResources); } @@ -562,7 +562,7 @@ private function registerOAuthConfiguration(ContainerBuilder $container, array $ /** * Registers the Swagger, ReDoc and Swagger UI configuration. */ - private function registerSwaggerConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerSwaggerConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { foreach (array_keys($config['swagger']['api_keys']) as $keyName) { if (!preg_match('/^[a-zA-Z0-9._-]+$/', $keyName)) { @@ -580,20 +580,20 @@ private function registerSwaggerConfiguration(ContainerBuilder $container, array return; } - $loader->load('openapi.xml'); + $loader->load('openapi.php'); if (class_exists(Yaml::class)) { - $loader->load('openapi/yaml.xml'); + $loader->load('openapi/yaml.php'); } - $loader->load('swagger_ui.xml'); + $loader->load('swagger_ui.php'); if ($config['use_symfony_listeners']) { - $loader->load('symfony/swagger_ui.xml'); + $loader->load('symfony/swagger_ui.php'); } if ($config['enable_swagger_ui']) { - $loader->load('state/swagger_ui.xml'); + $loader->load('state/swagger_ui.php'); } if (!$config['enable_swagger_ui'] && !$config['enable_re_doc']) { @@ -612,56 +612,56 @@ private function registerSwaggerConfiguration(ContainerBuilder $container, array $container->setParameter('api_platform.swagger_ui.extra_configuration', $config['openapi']['swagger_ui_extra_configuration'] ?: $config['swagger']['swagger_ui_extra_configuration']); } - private function registerJsonApiConfiguration(array $formats, XmlFileLoader $loader, array $config): void + private function registerJsonApiConfiguration(array $formats, PhpFileLoader $loader, array $config): void { if (!isset($formats['jsonapi'])) { return; } - $loader->load('jsonapi.xml'); - $loader->load('state/jsonapi.xml'); + $loader->load('jsonapi.php'); + $loader->load('state/jsonapi.php'); } - private function registerJsonLdHydraConfiguration(ContainerBuilder $container, array $formats, XmlFileLoader $loader, array $config): void + private function registerJsonLdHydraConfiguration(ContainerBuilder $container, array $formats, PhpFileLoader $loader, array $config): void { if (!isset($formats['jsonld'])) { return; } if ($config['use_symfony_listeners']) { - $loader->load('symfony/jsonld.xml'); + $loader->load('symfony/jsonld.php'); } else { - $loader->load('state/jsonld.xml'); + $loader->load('state/jsonld.php'); } - $loader->load('state/hydra.xml'); - $loader->load('jsonld.xml'); - $loader->load('hydra.xml'); + $loader->load('state/hydra.php'); + $loader->load('jsonld.php'); + $loader->load('hydra.php'); if (!$container->has('api_platform.json_schema.schema_factory')) { $container->removeDefinition('api_platform.hydra.json_schema.schema_factory'); } } - private function registerJsonHalConfiguration(array $formats, XmlFileLoader $loader): void + private function registerJsonHalConfiguration(array $formats, PhpFileLoader $loader): void { if (!isset($formats['jsonhal'])) { return; } - $loader->load('hal.xml'); + $loader->load('hal.php'); } - private function registerJsonProblemConfiguration(array $errorFormats, XmlFileLoader $loader): void + private function registerJsonProblemConfiguration(array $errorFormats, PhpFileLoader $loader): void { if (!isset($errorFormats['jsonproblem'])) { return; } - $loader->load('problem.xml'); + $loader->load('problem.php'); } - private function registerGraphQlConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerGraphQlConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { $enabled = $this->isConfigEnabled($container, $config['graphql']); $graphqlIntrospectionEnabled = $enabled && $this->isConfigEnabled($container, $config['graphql']['introspection']); @@ -687,7 +687,7 @@ private function registerGraphQlConfiguration(ContainerBuilder $container, array $container->setParameter('api_platform.graphql.default_ide', $config['graphql']['default_ide']); $container->setParameter('api_platform.graphql.nesting_separator', $config['graphql']['nesting_separator']); - $loader->load('graphql.xml'); + $loader->load('graphql.php'); if (!class_exists(Environment::class) || !isset($container->getParameter('kernel.bundles')['TwigBundle'])) { if ($graphiqlEnabled) { @@ -715,7 +715,7 @@ private function registerCacheConfiguration(ContainerBuilder $container): void } } - private function registerDoctrineOrmConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerDoctrineOrmConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { if (!$this->isConfigEnabled($container, $config['doctrine'])) { return; @@ -735,7 +735,7 @@ private function registerDoctrineOrmConfiguration(ContainerBuilder $container, a $container->registerForAutoconfiguration(OrmLinksHandlerInterface::class) ->addTag('api_platform.doctrine.orm.links_handler'); - $loader->load('doctrine_orm.xml'); + $loader->load('doctrine_orm.php'); if ($this->isConfigEnabled($container, $config['eager_loading'])) { return; @@ -747,7 +747,7 @@ private function registerDoctrineOrmConfiguration(ContainerBuilder $container, a $container->removeDefinition('api_platform.doctrine.orm.query_extension.filter_eager_loading'); } - private function registerDoctrineMongoDbOdmConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerDoctrineMongoDbOdmConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { if (!$this->isConfigEnabled($container, $config['doctrine_mongodb_odm'])) { return; @@ -762,23 +762,23 @@ private function registerDoctrineMongoDbOdmConfiguration(ContainerBuilder $conta $container->registerForAutoconfiguration(OdmLinksHandlerInterface::class) ->addTag('api_platform.doctrine.odm.links_handler'); - $loader->load('doctrine_mongodb_odm.xml'); + $loader->load('doctrine_mongodb_odm.php'); } - private function registerHttpCacheConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerHttpCacheConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { - $loader->load('http_cache.xml'); + $loader->load('http_cache.php'); if (!$this->isConfigEnabled($container, $config['http_cache']['invalidation'])) { return; } if ($this->isConfigEnabled($container, $config['doctrine'])) { - $loader->load('doctrine_orm_http_cache_purger.xml'); + $loader->load('doctrine_orm_http_cache_purger.php'); } - $loader->load('state/http_cache_purger.xml'); - $loader->load('http_cache_purger.xml'); + $loader->load('state/http_cache_purger.php'); + $loader->load('http_cache_purger.php'); foreach ($config['http_cache']['invalidation']['scoped_clients'] as $client) { $definition = $container->getDefinition($client); @@ -818,17 +818,17 @@ private function getFormats(array $configFormats): array return $formats; } - private function registerValidatorConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerValidatorConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { if (interface_exists(ValidatorInterface::class)) { - $loader->load('metadata/validator.xml'); - $loader->load('validator/validator.xml'); + $loader->load('metadata/validator.php'); + $loader->load('validator/validator.php'); if ($this->isConfigEnabled($container, $config['graphql'])) { - $loader->load('graphql/validator.xml'); + $loader->load('graphql/validator.php'); } - $loader->load($config['use_symfony_listeners'] ? 'validator/events.xml' : 'validator/state.xml'); + $loader->load($config['use_symfony_listeners'] ? 'validator/events.php' : 'validator/state.php'); $container->registerForAutoconfiguration(ValidationGroupsGeneratorInterface::class) ->addTag('api_platform.validation_groups_generator'); @@ -843,50 +843,50 @@ private function registerValidatorConfiguration(ContainerBuilder $container, arr $container->setParameter('api_platform.validator.serialize_payload_fields', $config['validator']['serialize_payload_fields']); } - private function registerDataCollectorConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerDataCollectorConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { if (!$config['enable_profiler']) { return; } - $loader->load('data_collector.xml'); + $loader->load('data_collector.php'); if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) { - $loader->load('debug.xml'); + $loader->load('debug.php'); } } - private function registerMercureConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerMercureConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { if (!$this->isConfigEnabled($container, $config['mercure'])) { return; } $container->setParameter('api_platform.mercure.include_type', $config['mercure']['include_type']); - $loader->load('state/mercure.xml'); + $loader->load('state/mercure.php'); if ($this->isConfigEnabled($container, $config['doctrine'])) { - $loader->load('doctrine_orm_mercure_publisher.xml'); + $loader->load('doctrine_orm_mercure_publisher.php'); } if ($this->isConfigEnabled($container, $config['doctrine_mongodb_odm'])) { - $loader->load('doctrine_odm_mercure_publisher.xml'); + $loader->load('doctrine_odm_mercure_publisher.php'); } if ($this->isConfigEnabled($container, $config['graphql'])) { - $loader->load('graphql_mercure.xml'); + $loader->load('graphql_mercure.php'); } } - private function registerMessengerConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerMessengerConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { if (!$this->isConfigEnabled($container, $config['messenger'])) { return; } - $loader->load('messenger.xml'); + $loader->load('messenger.php'); } - private function registerElasticsearchConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerElasticsearchConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { $enabled = $this->isConfigEnabled($container, $config['elasticsearch']); @@ -907,10 +907,10 @@ private function registerElasticsearchConfiguration(ContainerBuilder $container, $container->registerForAutoconfiguration(RequestBodySearchCollectionExtensionInterface::class) ->addTag('api_platform.elasticsearch.request_body_search_extension.collection'); $container->setParameter('api_platform.elasticsearch.hosts', $config['elasticsearch']['hosts']); - $loader->load('elasticsearch.xml'); + $loader->load('elasticsearch.php'); } - private function registerSecurityConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerSecurityConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { /** @var string[] $bundles */ $bundles = $container->getParameter('kernel.bundles'); @@ -919,20 +919,20 @@ private function registerSecurityConfiguration(ContainerBuilder $container, arra return; } - $loader->load('security.xml'); + $loader->load('security.php'); - $loader->load('state/security.xml'); + $loader->load('state/security.php'); if (interface_exists(ValidatorInterface::class)) { - $loader->load('state/security_validator.xml'); + $loader->load('state/security_validator.php'); } if ($this->isConfigEnabled($container, $config['graphql'])) { - $loader->load('graphql/security.xml'); + $loader->load('graphql/security.php'); } } - private function registerOpenApiConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerOpenApiConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { $container->setParameter('api_platform.openapi.termsOfService', $config['openapi']['termsOfService']); $container->setParameter('api_platform.openapi.contact.name', $config['openapi']['contact']['name']); @@ -953,31 +953,31 @@ private function registerOpenApiConfiguration(ContainerBuilder $container, array $container->setParameter('api_platform.openapi.errorResourceClass', $config['openapi']['error_resource_class'] ?? null); $container->setParameter('api_platform.openapi.validationErrorResourceClass', $config['openapi']['validation_error_resource_class'] ?? null); - $loader->load('json_schema.xml'); + $loader->load('json_schema.php'); } - private function registerMakerConfiguration(ContainerBuilder $container, array $config, XmlFileLoader $loader): void + private function registerMakerConfiguration(ContainerBuilder $container, array $config, PhpFileLoader $loader): void { if (!$this->isConfigEnabled($container, $config['maker'])) { return; } - $loader->load('maker.xml'); + $loader->load('maker.php'); } - private function registerArgumentResolverConfiguration(XmlFileLoader $loader): void + private function registerArgumentResolverConfiguration(PhpFileLoader $loader): void { - $loader->load('argument_resolver.xml'); + $loader->load('argument_resolver.php'); } - private function registerLinkSecurityConfiguration(XmlFileLoader $loader, array $config): void + private function registerLinkSecurityConfiguration(PhpFileLoader $loader, array $config): void { if ($config['enable_link_security']) { - $loader->load('link_security.xml'); + $loader->load('link_security.php'); } } - private function registerJsonStreamerConfiguration(ContainerBuilder $container, XmlFileLoader $loader, array $formats, array $config): void + private function registerJsonStreamerConfiguration(ContainerBuilder $container, PhpFileLoader $loader, array $formats, array $config): void { if (!$config['enable_json_streamer']) { return; @@ -998,17 +998,17 @@ private function registerJsonStreamerConfiguration(ContainerBuilder $container, $container->setParameter('.json_streamer.lazy_ghosts_dir.jsonld', '%kernel.cache_dir%/json_streamer/lazy_ghost/jsonld'); } - $loader->load('json_streamer/common.xml'); + $loader->load('json_streamer/common.php'); if ($config['use_symfony_listeners']) { - $loader->load('json_streamer/events.xml'); + $loader->load('json_streamer/events.php'); } else { if (isset($formats['jsonld'])) { - $loader->load('json_streamer/hydra.xml'); + $loader->load('json_streamer/hydra.php'); } if (isset($formats['json'])) { - $loader->load('json_streamer/json.xml'); + $loader->load('json_streamer/json.php'); } } } diff --git a/src/Symfony/Bundle/Resources/config/api.php b/src/Symfony/Bundle/Resources/config/api.php new file mode 100644 index 00000000000..f136dbe8fe2 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/api.php @@ -0,0 +1,203 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.action.not_found', 'ApiPlatform\Symfony\Action\NotFoundAction') + ->public(); + + $services->alias('ApiPlatform\Symfony\Action\NotFoundAction', 'api_platform.action.not_found') + ->public(); + + $services->set('api_platform.action.not_exposed', 'ApiPlatform\Symfony\Action\NotExposedAction') + ->public(); + + $services->alias('ApiPlatform\Symfony\Action\NotExposedAction', 'api_platform.action.not_exposed') + ->public(); + + $services->alias('api_platform.serializer', 'serializer'); + + $services->alias('api_platform.property_accessor', 'property_accessor'); + + $services->alias('api_platform.property_info', 'property_info'); + + $services->set('api_platform.negotiator', 'Negotiation\Negotiator'); + + $services->set('api_platform.resource_class_resolver', 'ApiPlatform\Metadata\ResourceClassResolver') + ->args([service('api_platform.metadata.resource.name_collection_factory')]); + + $services->alias('ApiPlatform\Metadata\ResourceClassResolverInterface', 'api_platform.resource_class_resolver'); + + $services->alias('ApiPlatform\Metadata\UrlGeneratorInterface', 'api_platform.router'); + + $services->set('api_platform.router', 'ApiPlatform\Symfony\Routing\Router') + ->args([ + service('router'), + '%api_platform.url_generation_strategy%', + ]); + + $services->set('api_platform.serializer.context_builder', 'ApiPlatform\Serializer\SerializerContextBuilder') + ->arg(0, service('api_platform.metadata.resource.metadata_collection_factory')) + ->arg('$debug', '%kernel.debug%'); + + $services->set('api_platform.serializer.filter_parameter_provider', 'ApiPlatform\Serializer\Parameter\SerializerFilterParameterProvider') + ->args([service('api_platform.filter_locator')]) + ->tag('api_platform.parameter_provider', ['key' => 'api_platform.serializer.filter_parameter_provider', 'priority' => -895]); + + $services->alias('ApiPlatform\State\SerializerContextBuilderInterface', 'api_platform.serializer.context_builder'); + + $services->set('api_platform.serializer.context_builder.filter', 'ApiPlatform\Serializer\SerializerFilterContextBuilder') + ->decorate('api_platform.serializer.context_builder', null, 0) + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.filter_locator'), + service('api_platform.serializer.context_builder.filter.inner'), + ]); + + $services->set('api_platform.serializer.property_filter', 'ApiPlatform\Serializer\Filter\PropertyFilter') + ->abstract() + ->arg('$parameterName', 'properties') + ->arg('$overrideDefaultProperties', false) + ->arg('$whitelist', null) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Serializer\Filter\PropertyFilter', 'api_platform.serializer.property_filter'); + + $services->set('api_platform.serializer.group_filter', 'ApiPlatform\Serializer\Filter\GroupFilter') + ->abstract(); + + $services->alias('ApiPlatform\Serializer\Filter\GroupFilter', 'api_platform.serializer.group_filter'); + + $services->set('api_platform.serializer.normalizer.item', 'ApiPlatform\Serializer\ItemNormalizer') + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.property_accessor'), + service('api_platform.name_converter')->ignoreOnInvalid(), + service('serializer.mapping.class_metadata_factory')->ignoreOnInvalid(), + null, + service('api_platform.metadata.resource.metadata_collection_factory')->ignoreOnInvalid(), + service('api_platform.security.resource_access_checker')->ignoreOnInvalid(), + [], + service('api_platform.http_cache.tag_collector')->ignoreOnInvalid(), + ]) + ->tag('serializer.normalizer', ['priority' => -895]); + + $services->set('api_platform.serializer.mapping.class_metadata_factory', 'ApiPlatform\Serializer\Mapping\Factory\ClassMetadataFactory') + ->decorate('serializer.mapping.class_metadata_factory', null, -1) + ->args([service('api_platform.serializer.mapping.class_metadata_factory.inner')]); + + $services->set('api_platform.serializer.mapping.cache_class_metadata_factory', 'Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory') + ->decorate('api_platform.serializer.mapping.class_metadata_factory', null, -2) + ->args([ + service('api_platform.serializer.mapping.cache_class_metadata_factory.inner'), + service('serializer.mapping.cache.symfony'), + ]); + + $services->set('api_platform.path_segment_name_generator.underscore', 'ApiPlatform\Metadata\Operation\UnderscorePathSegmentNameGenerator'); + + $services->set('api_platform.path_segment_name_generator.dash', 'ApiPlatform\Metadata\Operation\DashPathSegmentNameGenerator'); + + $services->set('api_platform.metadata.path_segment_name_generator.underscore', 'ApiPlatform\Metadata\Operation\UnderscorePathSegmentNameGenerator') + ->args([service('api_platform.inflector')->nullOnInvalid()]); + + $services->set('api_platform.metadata.path_segment_name_generator.dash', 'ApiPlatform\Metadata\Operation\DashPathSegmentNameGenerator') + ->args([service('api_platform.inflector')->nullOnInvalid()]); + + $services->set('api_platform.metadata.inflector', 'ApiPlatform\Metadata\Util\Inflector'); + + $services->set('api_platform.cache.route_name_resolver') + ->parent('cache.system') + ->tag('cache.pool'); + + $services->set('api_platform.route_loader', 'ApiPlatform\Symfony\Routing\ApiLoader') + ->args([ + service('kernel'), + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('service_container'), + '%api_platform.formats%', + '%api_platform.resource_class_directories%', + '%api_platform.graphql.enabled%', + '%api_platform.enable_entrypoint%', + '%api_platform.enable_docs%', + '%api_platform.graphql.graphiql.enabled%', + ]) + ->tag('routing.loader'); + + $services->set('api_platform.symfony.iri_converter.skolem', 'ApiPlatform\Symfony\Routing\SkolemIriConverter') + ->args([service('api_platform.router')]); + + $services->set('api_platform.api.identifiers_extractor', 'ApiPlatform\Metadata\IdentifiersExtractor') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.property_accessor'), + ]); + + $services->alias('api_platform.identifiers_extractor', 'api_platform.api.identifiers_extractor'); + + $services->alias('ApiPlatform\Metadata\IdentifiersExtractorInterface', 'api_platform.api.identifiers_extractor'); + + $services->set('api_platform.uri_variables.converter', 'ApiPlatform\Metadata\UriVariablesConverter') + ->args([ + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + tagged_iterator('api_platform.uri_variables.transformer'), + ]); + + $services->set('api_platform.uri_variables.transformer.integer', 'ApiPlatform\Metadata\UriVariableTransformer\IntegerUriVariableTransformer') + ->tag('api_platform.uri_variables.transformer', ['priority' => -100]); + + $services->set('api_platform.uri_variables.transformer.date_time', 'ApiPlatform\Metadata\UriVariableTransformer\DateTimeUriVariableTransformer') + ->tag('api_platform.uri_variables.transformer', ['priority' => -100]); + + $services->alias('api_platform.iri_converter', 'api_platform.symfony.iri_converter'); + + $services->set('api_platform.symfony.iri_converter', 'ApiPlatform\Symfony\Routing\IriConverter') + ->args([ + service('api_platform.state_provider.locator'), + service('api_platform.router'), + service('api_platform.api.identifiers_extractor'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.uri_variables.converter'), + service('api_platform.symfony.iri_converter.skolem'), + service('api_platform.metadata.operation.metadata_factory'), + ]); + + $services->alias('ApiPlatform\Metadata\IriConverterInterface', 'api_platform.symfony.iri_converter'); + + $services->set('api_platform.state.error_provider', 'ApiPlatform\State\ErrorProvider') + ->arg('$debug', '%kernel.debug%') + ->arg('$resourceClassResolver', service('api_platform.resource_class_resolver')) + ->arg('$resourceMetadataCollectionFactory', service('api_platform.metadata.resource.metadata_collection_factory')) + ->tag('api_platform.state_provider', ['key' => 'api_platform.state.error_provider']); + + $services->set('api_platform.normalizer.constraint_violation_list', 'ApiPlatform\Serializer\ConstraintViolationListNormalizer') + ->args([ + '%api_platform.validator.serialize_payload_fields%', + service('api_platform.name_converter')->ignoreOnInvalid(), + ]) + ->tag('serializer.normalizer', ['priority' => -780]); + + $services->set('api_platform.serializer.property_metadata_loader', 'ApiPlatform\Serializer\Mapping\Loader\PropertyMetadataLoader') + ->args([service('api_platform.metadata.property.name_collection_factory')]); +}; diff --git a/src/Symfony/Bundle/Resources/config/api.xml b/src/Symfony/Bundle/Resources/config/api.xml deleted file mode 100644 index f192d15fc90..00000000000 --- a/src/Symfony/Bundle/Resources/config/api.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.url_generation_strategy% - - - - - - - %kernel.debug% - - - - - - - - - - - - - - - - properties - false - null - - - - - - - - - - - - - - - - null - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.formats% - %api_platform.resource_class_directories% - %api_platform.graphql.enabled% - %api_platform.enable_entrypoint% - %api_platform.enable_docs% - %api_platform.graphql.graphiql.enabled% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %kernel.debug% - - - - - - - %api_platform.validator.serialize_payload_fields% - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/argument_resolver.php b/src/Symfony/Bundle/Resources/config/argument_resolver.php new file mode 100644 index 00000000000..49d8552f7c5 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/argument_resolver.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.argument_resolver.payload', 'ApiPlatform\Symfony\Bundle\ArgumentResolver\PayloadArgumentResolver') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.serializer.context_builder'), + ]) + ->tag('controller.argument_value_resolver'); +}; diff --git a/src/Symfony/Bundle/Resources/config/argument_resolver.xml b/src/Symfony/Bundle/Resources/config/argument_resolver.xml deleted file mode 100644 index 68f063d74f7..00000000000 --- a/src/Symfony/Bundle/Resources/config/argument_resolver.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/data_collector.php b/src/Symfony/Bundle/Resources/config/data_collector.php new file mode 100644 index 00000000000..9bf334a7d88 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/data_collector.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.data_collector.request', 'ApiPlatform\Symfony\Bundle\DataCollector\RequestDataCollector') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.filter_locator'), + ]) + ->tag('data_collector', ['template' => '@ApiPlatform/DataCollector/request.html.twig', 'id' => 'api_platform.data_collector.request', 'priority' => 334]); +}; diff --git a/src/Symfony/Bundle/Resources/config/data_collector.xml b/src/Symfony/Bundle/Resources/config/data_collector.xml deleted file mode 100644 index 689561d3f41..00000000000 --- a/src/Symfony/Bundle/Resources/config/data_collector.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/debug.php b/src/Symfony/Bundle/Resources/config/debug.php new file mode 100644 index 00000000000..7d132cd3cdf --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/debug.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('debug.var_dumper.cloner', 'Symfony\Component\VarDumper\Cloner\VarCloner'); + + $services->set('debug.var_dumper.cli_dumper', 'Symfony\Component\VarDumper\Dumper\CliDumper'); + + $services->set('debug.api_platform.debug_resource.command', 'ApiPlatform\Symfony\Bundle\Command\DebugResourceCommand') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('debug.var_dumper.cloner'), + service('debug.var_dumper.cli_dumper'), + ]) + ->tag('console.command'); +}; diff --git a/src/Symfony/Bundle/Resources/config/debug.xml b/src/Symfony/Bundle/Resources/config/debug.xml deleted file mode 100644 index df1ad13979e..00000000000 --- a/src/Symfony/Bundle/Resources/config/debug.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.php b/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.php new file mode 100644 index 00000000000..dd74180d259 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.php @@ -0,0 +1,211 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.doctrine_mongodb.odm.default_document_manager.property_info_extractor', 'ApiPlatform\Doctrine\Odm\PropertyInfo\DoctrineExtractor') + ->args([service('doctrine_mongodb.odm.default_document_manager')]) + ->tag('property_info.list_extractor', ['priority' => -1001]) + ->tag('property_info.type_extractor', ['priority' => -999]) + ->tag('property_info.access_extractor', ['priority' => -999]); + + $services->set('api_platform.doctrine.metadata_factory', 'Doctrine\Persistence\Mapping\ClassMetadataFactory')->factory([service('doctrine_mongodb.odm.default_document_manager'), 'getMetadataFactory']); + + $services->set('api_platform.doctrine_mongodb.odm.state.remove_processor', 'ApiPlatform\Doctrine\Common\State\RemoveProcessor') + ->args([service('doctrine_mongodb')]) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'api_platform.doctrine_mongodb.odm.state.remove_processor']) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'ApiPlatform\Doctrine\Common\State\RemoveProcessor']); + + $services->alias('ApiPlatform\Doctrine\Common\State\RemoveProcessor', 'api_platform.doctrine_mongodb.odm.state.remove_processor'); + + $services->set('api_platform.doctrine_mongodb.odm.state.persist_processor', 'ApiPlatform\Doctrine\Common\State\PersistProcessor') + ->args([service('doctrine_mongodb')]) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'api_platform.doctrine_mongodb.odm.state.persist_processor']) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'ApiPlatform\Doctrine\Common\State\PersistProcessor']); + + $services->alias('ApiPlatform\Doctrine\Common\State\PersistProcessor', 'api_platform.doctrine_mongodb.odm.state.persist_processor'); + + $services->set('api_platform.doctrine_mongodb.odm.search_filter', 'ApiPlatform\Doctrine\Odm\Filter\SearchFilter') + ->abstract() + ->arg(0, service('doctrine_mongodb')) + ->arg(1, service('api_platform.iri_converter')) + ->arg(2, service('api_platform.identifiers_extractor')->ignoreOnInvalid()) + ->arg(3, service('api_platform.property_accessor')) + ->arg(4, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Odm\Filter\SearchFilter', 'api_platform.doctrine_mongodb.odm.search_filter'); + + $services->set('api_platform.doctrine_mongodb.odm.search_filter.instance') + ->parent('api_platform.doctrine_mongodb.odm.search_filter') + ->args([[]]); + + $services->set('api_platform.doctrine_mongodb.odm.boolean_filter', 'ApiPlatform\Doctrine\Odm\Filter\BooleanFilter') + ->abstract() + ->arg(0, service('doctrine_mongodb')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Odm\Filter\BooleanFilter', 'api_platform.doctrine_mongodb.odm.boolean_filter'); + + $services->set('api_platform.doctrine_mongodb.odm.boolean_filter.instance') + ->parent('api_platform.doctrine_mongodb.odm.boolean_filter') + ->args([[]]); + + $services->set('api_platform.doctrine_mongodb.odm.date_filter', 'ApiPlatform\Doctrine\Odm\Filter\DateFilter') + ->abstract() + ->arg(0, service('doctrine_mongodb')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Odm\Filter\DateFilter', 'api_platform.doctrine_mongodb.odm.date_filter'); + + $services->set('api_platform.doctrine_mongodb.odm.date_filter.instance') + ->parent('api_platform.doctrine_mongodb.odm.date_filter') + ->args([[]]); + + $services->set('api_platform.doctrine_mongodb.odm.exists_filter', 'ApiPlatform\Doctrine\Odm\Filter\ExistsFilter') + ->abstract() + ->arg(0, service('doctrine_mongodb')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$existsParameterName', '%api_platform.collection.exists_parameter_name%') + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Odm\Filter\ExistsFilter', 'api_platform.doctrine_mongodb.odm.exists_filter'); + + $services->set('api_platform.doctrine_mongodb.odm.exists_filter.instance') + ->parent('api_platform.doctrine_mongodb.odm.exists_filter') + ->args([[]]); + + $services->set('api_platform.doctrine_mongodb.odm.numeric_filter', 'ApiPlatform\Doctrine\Odm\Filter\NumericFilter') + ->abstract() + ->arg(0, service('doctrine_mongodb')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Odm\Filter\NumericFilter', 'api_platform.doctrine_mongodb.odm.numeric_filter'); + + $services->set('api_platform.doctrine_mongodb.odm.numeric_filter.instance') + ->parent('api_platform.doctrine_mongodb.odm.numeric_filter') + ->args([[]]); + + $services->set('api_platform.doctrine_mongodb.odm.order_filter', 'ApiPlatform\Doctrine\Odm\Filter\OrderFilter') + ->abstract() + ->arg(0, service('doctrine_mongodb')) + ->arg(1, '%api_platform.collection.order_parameter_name%') + ->arg(2, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Odm\Filter\OrderFilter', 'api_platform.doctrine_mongodb.odm.order_filter'); + + $services->set('api_platform.doctrine_mongodb.odm.order_filter.instance') + ->parent('api_platform.doctrine_mongodb.odm.order_filter') + ->args([[]]); + + $services->set('api_platform.doctrine_mongodb.odm.range_filter', 'ApiPlatform\Doctrine\Odm\Filter\RangeFilter') + ->abstract() + ->arg(0, service('doctrine_mongodb')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Odm\Filter\RangeFilter', 'api_platform.doctrine_mongodb.odm.range_filter'); + + $services->set('api_platform.doctrine_mongodb.odm.range_filter.instance') + ->parent('api_platform.doctrine_mongodb.odm.range_filter') + ->args([[]]); + + $services->set('api_platform.doctrine_mongodb.odm.aggregation_extension.filter', 'ApiPlatform\Doctrine\Odm\Extension\FilterExtension') + ->args([service('api_platform.filter_locator')]) + ->tag('api_platform.doctrine_mongodb.odm.aggregation_extension.collection', ['priority' => 32]); + + $services->alias('ApiPlatform\Doctrine\Odm\Extension\FilterExtension', 'api_platform.doctrine_mongodb.odm.aggregation_extension.filter'); + + $services->set('api_platform.doctrine_mongodb.odm.aggregation_extension.pagination', 'ApiPlatform\Doctrine\Odm\Extension\PaginationExtension') + ->args([ + service('doctrine_mongodb'), + service('api_platform.pagination'), + ]) + ->tag('api_platform.doctrine_mongodb.odm.aggregation_extension.collection'); + + $services->alias('ApiPlatform\Doctrine\Odm\Extension\PaginationExtension', 'api_platform.doctrine_mongodb.odm.aggregation_extension.pagination'); + + $services->set('api_platform.doctrine_mongodb.odm.aggregation_extension.order', 'ApiPlatform\Doctrine\Odm\Extension\OrderExtension') + ->args([ + '%api_platform.collection.order%', + service('doctrine_mongodb'), + ]) + ->tag('api_platform.doctrine_mongodb.odm.aggregation_extension.collection', ['priority' => 16]); + + $services->alias('ApiPlatform\Doctrine\Odm\Extension\OrderExtension', 'api_platform.doctrine_mongodb.odm.aggregation_extension.order'); + + $services->set('api_platform.doctrine_mongodb.odm.extension.parameter_extension', 'ApiPlatform\Doctrine\Odm\Extension\ParameterExtension') + ->args([ + service('api_platform.filter_locator'), + service('doctrine_mongodb')->nullOnInvalid(), + service('logger')->nullOnInvalid(), + ]) + ->tag('api_platform.doctrine_mongodb.odm.aggregation_extension.collection', ['priority' => 32]) + ->tag('api_platform.doctrine_mongodb.odm.aggregation_extension.item'); + + $services->alias('ApiPlatform\Doctrine\Odm\Extension\ParameterExtension', 'api_platform.doctrine_mongodb.odm.extension.parameter_extension'); + + $services->set('api_platform.doctrine_mongodb.odm.metadata.property.metadata_factory', 'ApiPlatform\Doctrine\Odm\Metadata\Property\DoctrineMongoDbOdmPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 40) + ->args([ + service('doctrine_mongodb'), + service('api_platform.doctrine_mongodb.odm.metadata.property.metadata_factory.inner'), + ]); + + $services->set('api_platform.doctrine_mongodb.odm.state.collection_provider', 'ApiPlatform\Doctrine\Odm\State\CollectionProvider') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('doctrine_mongodb'), + tagged_iterator('api_platform.doctrine_mongodb.odm.aggregation_extension.collection'), + tagged_locator('api_platform.doctrine.odm.links_handler', 'key'), + ]) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'ApiPlatform\Doctrine\Odm\State\CollectionProvider']) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'api_platform.doctrine_mongodb.odm.state.collection_provider']); + + $services->alias('ApiPlatform\Doctrine\Odm\State\CollectionProvider', 'api_platform.doctrine_mongodb.odm.state.collection_provider'); + + $services->set('api_platform.doctrine_mongodb.odm.state.item_provider', 'ApiPlatform\Doctrine\Odm\State\ItemProvider') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('doctrine_mongodb'), + tagged_iterator('api_platform.doctrine_mongodb.odm.aggregation_extension.item'), + tagged_locator('api_platform.doctrine.odm.links_handler', 'key'), + ]) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'ApiPlatform\Doctrine\Odm\State\ItemProvider']) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'api_platform.doctrine_mongodb.odm.state.item_provider']); + + $services->alias('ApiPlatform\Doctrine\Odm\State\ItemProvider', 'api_platform.doctrine_mongodb.odm.state.item_provider'); + + $services->alias('api_platform.state.item_provider', 'ApiPlatform\Doctrine\Odm\State\ItemProvider'); + + $services->set('api_platform.doctrine.odm.metadata.resource.metadata_collection_factory', 'ApiPlatform\Doctrine\Odm\Metadata\Resource\DoctrineMongoDbOdmResourceCollectionMetadataFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 40) + ->args([ + service('doctrine_mongodb'), + service('api_platform.doctrine.odm.metadata.resource.metadata_collection_factory.inner'), + ]); + + $services->set('api_platform.doctrine.odm.links_handler', 'ApiPlatform\Doctrine\Odm\State\LinksHandler') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('doctrine_mongodb'), + ]) + ->tag('api_platform.doctrine.odm.links_handler', ['key' => 'api_platform.doctrine.odm.links_handler']); +}; diff --git a/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml b/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml deleted file mode 100644 index 449d61f172f..00000000000 --- a/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.collection.exists_parameter_name% - - - - - - - - - - - - - - - - - - - - %api_platform.collection.order_parameter_name% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.collection.order% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/doctrine_odm_mercure_publisher.php b/src/Symfony/Bundle/Resources/config/doctrine_odm_mercure_publisher.php new file mode 100644 index 00000000000..5406aacc641 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/doctrine_odm_mercure_publisher.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.doctrine_mongodb.odm.listener.mercure.publish', 'ApiPlatform\Symfony\Doctrine\EventListener\PublishMercureUpdatesListener') + ->args([ + service('api_platform.resource_class_resolver'), + service('api_platform.symfony.iri_converter'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.serializer'), + '%api_platform.formats%', + service('messenger.default_bus')->ignoreOnInvalid(), + service('Symfony\Component\Mercure\HubRegistry'), + service('api_platform.graphql.subscription.subscription_manager')->ignoreOnInvalid(), + service('api_platform.graphql.subscription.mercure_iri_generator')->ignoreOnInvalid(), + null, + '%api_platform.mercure.include_type%', + ]) + ->tag('doctrine_mongodb.odm.event_listener', ['event' => 'onFlush']) + ->tag('doctrine_mongodb.odm.event_listener', ['event' => 'postFlush']); +}; diff --git a/src/Symfony/Bundle/Resources/config/doctrine_odm_mercure_publisher.xml b/src/Symfony/Bundle/Resources/config/doctrine_odm_mercure_publisher.xml deleted file mode 100644 index 7436ce6f868..00000000000 --- a/src/Symfony/Bundle/Resources/config/doctrine_odm_mercure_publisher.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - %api_platform.formats% - - - - - null - %api_platform.mercure.include_type% - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/doctrine_orm.php b/src/Symfony/Bundle/Resources/config/doctrine_orm.php new file mode 100644 index 00000000000..57504522571 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/doctrine_orm.php @@ -0,0 +1,247 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.doctrine.metadata_factory', 'Doctrine\Persistence\Mapping\ClassMetadataFactory')->factory([service('doctrine.orm.default_entity_manager'), 'getMetadataFactory']); + + $services->set('api_platform.doctrine.orm.state.remove_processor', 'ApiPlatform\Doctrine\Common\State\RemoveProcessor') + ->args([service('doctrine')]) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'api_platform.doctrine.orm.state.remove_processor']) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'ApiPlatform\Doctrine\Common\State\RemoveProcessor']); + + $services->alias('ApiPlatform\Doctrine\Common\State\RemoveProcessor', 'api_platform.doctrine.orm.state.remove_processor'); + + $services->set('api_platform.doctrine.orm.state.persist_processor', 'ApiPlatform\Doctrine\Common\State\PersistProcessor') + ->args([service('doctrine')]) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'api_platform.doctrine.orm.state.persist_processor']) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'ApiPlatform\Doctrine\Common\State\PersistProcessor']); + + $services->alias('ApiPlatform\Doctrine\Common\State\PersistProcessor', 'api_platform.doctrine.orm.state.persist_processor'); + + $services->set('api_platform.doctrine.orm.order_filter', 'ApiPlatform\Doctrine\Orm\Filter\OrderFilter') + ->abstract() + ->arg(0, service('doctrine')) + ->arg(1, '%api_platform.collection.order_parameter_name%') + ->arg(2, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()) + ->arg('$orderNullsComparison', '%api_platform.collection.order_nulls_comparison%'); + + $services->alias('ApiPlatform\Doctrine\Orm\Filter\OrderFilter', 'api_platform.doctrine.orm.order_filter'); + + $services->set('api_platform.doctrine.orm.order_filter.instance') + ->parent('api_platform.doctrine.orm.order_filter') + ->args([[]]); + + $services->set('api_platform.doctrine.orm.range_filter', 'ApiPlatform\Doctrine\Orm\Filter\RangeFilter') + ->abstract() + ->arg(0, service('doctrine')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Orm\Filter\RangeFilter', 'api_platform.doctrine.orm.range_filter'); + + $services->set('api_platform.doctrine.orm.range_filter.instance') + ->parent('api_platform.doctrine.orm.range_filter') + ->args([[]]); + + $services->set('api_platform.doctrine.orm.date_filter', 'ApiPlatform\Doctrine\Orm\Filter\DateFilter') + ->abstract() + ->arg(0, service('doctrine')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Orm\Filter\DateFilter', 'api_platform.doctrine.orm.date_filter'); + + $services->set('api_platform.doctrine.orm.date_filter.instance') + ->parent('api_platform.doctrine.orm.date_filter') + ->args([[]]); + + $services->set('api_platform.doctrine.orm.backed_enum_filter', 'ApiPlatform\Doctrine\Orm\Filter\BackedEnumFilter') + ->abstract() + ->arg(0, service('doctrine')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Orm\Filter\BackedEnumFilter', 'api_platform.doctrine.orm.backed_enum_filter'); + + $services->set('api_platform.doctrine.orm.backed_enum_filter.instance') + ->parent('api_platform.doctrine.orm.backed_enum_filter') + ->args([[]]); + + $services->set('api_platform.doctrine.orm.boolean_filter', 'ApiPlatform\Doctrine\Orm\Filter\BooleanFilter') + ->abstract() + ->arg(0, service('doctrine')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Orm\Filter\BooleanFilter', 'api_platform.doctrine.orm.boolean_filter'); + + $services->set('api_platform.doctrine.orm.boolean_filter.instance') + ->parent('api_platform.doctrine.orm.boolean_filter') + ->args([[]]); + + $services->set('api_platform.doctrine.orm.numeric_filter', 'ApiPlatform\Doctrine\Orm\Filter\NumericFilter') + ->abstract() + ->arg(0, service('doctrine')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Orm\Filter\NumericFilter', 'api_platform.doctrine.orm.numeric_filter'); + + $services->set('api_platform.doctrine.orm.numeric_filter.instance') + ->parent('api_platform.doctrine.orm.numeric_filter') + ->args([[]]); + + $services->set('api_platform.doctrine.orm.exists_filter', 'ApiPlatform\Doctrine\Orm\Filter\ExistsFilter') + ->abstract() + ->arg(0, service('doctrine')) + ->arg(1, service('logger')->ignoreOnInvalid()) + ->arg('$existsParameterName', '%api_platform.collection.exists_parameter_name%') + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Orm\Filter\ExistsFilter', 'api_platform.doctrine.orm.exists_filter'); + + $services->set('api_platform.doctrine.orm.exists_filter.instance') + ->parent('api_platform.doctrine.orm.exists_filter') + ->args([[]]); + + $services->set('api_platform.doctrine.orm.query_extension.eager_loading', 'ApiPlatform\Doctrine\Orm\Extension\EagerLoadingExtension') + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + '%api_platform.eager_loading.max_joins%', + '%api_platform.eager_loading.force_eager%', + '%api_platform.eager_loading.fetch_partial%', + service('serializer.mapping.class_metadata_factory'), + ]) + ->tag('api_platform.doctrine.orm.query_extension.item', ['priority' => -8]) + ->tag('api_platform.doctrine.orm.query_extension.collection', ['priority' => -18]); + + $services->alias('ApiPlatform\Doctrine\Orm\Extension\EagerLoadingExtension', 'api_platform.doctrine.orm.query_extension.eager_loading'); + + $services->set('api_platform.doctrine.orm.query_extension.filter', 'ApiPlatform\Doctrine\Orm\Extension\FilterExtension') + ->args([service('api_platform.filter_locator')]) + ->tag('api_platform.doctrine.orm.query_extension.collection', ['priority' => -16]); + + $services->alias('ApiPlatform\Doctrine\Orm\Extension\FilterExtension', 'api_platform.doctrine.orm.query_extension.filter'); + + $services->set('api_platform.doctrine.orm.query_extension.filter_eager_loading', 'ApiPlatform\Doctrine\Orm\Extension\FilterEagerLoadingExtension') + ->args([ + '%api_platform.eager_loading.force_eager%', + service('api_platform.resource_class_resolver'), + ]) + ->tag('api_platform.doctrine.orm.query_extension.collection', ['priority' => -17]); + + $services->alias('ApiPlatform\Doctrine\Orm\Extension\FilterEagerLoadingExtension', 'api_platform.doctrine.orm.query_extension.filter_eager_loading'); + + $services->set('api_platform.doctrine.orm.query_extension.pagination', 'ApiPlatform\Doctrine\Orm\Extension\PaginationExtension') + ->args([ + service('doctrine'), + service('api_platform.pagination'), + ]) + ->tag('api_platform.doctrine.orm.query_extension.collection', ['priority' => -64]); + + $services->alias('ApiPlatform\Doctrine\Orm\Extension\PaginationExtension', 'api_platform.doctrine.orm.query_extension.pagination'); + + $services->set('api_platform.doctrine.orm.query_extension.order', 'ApiPlatform\Doctrine\Orm\Extension\OrderExtension') + ->args(['%api_platform.collection.order%']) + ->tag('api_platform.doctrine.orm.query_extension.collection', ['priority' => -32]); + + $services->alias('ApiPlatform\Doctrine\Orm\Extension\OrderExtension', 'api_platform.doctrine.orm.query_extension.order'); + + $services->set('api_platform.doctrine.orm.extension.parameter_extension', 'ApiPlatform\Doctrine\Orm\Extension\ParameterExtension') + ->args([ + service('api_platform.filter_locator'), + service('doctrine')->nullOnInvalid(), + service('logger')->nullOnInvalid(), + ]) + ->tag('api_platform.doctrine.orm.query_extension.collection', ['priority' => -16]) + ->tag('api_platform.doctrine.orm.query_extension.item', ['priority' => -9]); + + $services->alias('ApiPlatform\Doctrine\Orm\Extension\ParameterExtension', 'api_platform.doctrine.orm.extension.parameter_extension'); + + $services->set('api_platform.doctrine.orm.metadata.property.metadata_factory', 'ApiPlatform\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 40) + ->args([ + service('doctrine'), + service('api_platform.doctrine.orm.metadata.property.metadata_factory.inner'), + ]); + + $services->set('api_platform.doctrine.orm.state.collection_provider', 'ApiPlatform\Doctrine\Orm\State\CollectionProvider') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('doctrine'), + tagged_iterator('api_platform.doctrine.orm.query_extension.collection'), + tagged_locator('api_platform.doctrine.orm.links_handler', 'key'), + ]) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'ApiPlatform\Doctrine\Orm\State\CollectionProvider']) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'api_platform.doctrine.orm.state.collection_provider']); + + $services->alias('ApiPlatform\Doctrine\Orm\State\CollectionProvider', 'api_platform.doctrine.orm.state.collection_provider'); + + $services->set('api_platform.doctrine.orm.state.item_provider', 'ApiPlatform\Doctrine\Orm\State\ItemProvider') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('doctrine'), + tagged_iterator('api_platform.doctrine.orm.query_extension.item'), + tagged_locator('api_platform.doctrine.orm.links_handler', 'key'), + ]) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'ApiPlatform\Doctrine\Orm\State\ItemProvider']) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'api_platform.doctrine.orm.state.item_provider']); + + $services->alias('ApiPlatform\Doctrine\Orm\State\ItemProvider', 'api_platform.doctrine.orm.state.item_provider'); + + $services->alias('api_platform.state.item_provider', 'ApiPlatform\Doctrine\Orm\State\ItemProvider'); + + $services->set('api_platform.doctrine.orm.search_filter', 'ApiPlatform\Doctrine\Orm\Filter\SearchFilter') + ->abstract() + ->arg(0, service('doctrine')) + ->arg(1, service('api_platform.iri_converter')) + ->arg(2, service('api_platform.property_accessor')) + ->arg(3, service('logger')->ignoreOnInvalid()) + ->arg('$identifiersExtractor', service('api_platform.identifiers_extractor')->ignoreOnInvalid()) + ->arg('$nameConverter', service('api_platform.name_converter')->ignoreOnInvalid()); + + $services->alias('ApiPlatform\Doctrine\Orm\Filter\SearchFilter', 'api_platform.doctrine.orm.search_filter'); + + $services->set('api_platform.doctrine.orm.search_filter.instance') + ->parent('api_platform.doctrine.orm.search_filter') + ->args([[]]); + + $services->set('api_platform.doctrine.orm.metadata.resource.metadata_collection_factory', 'ApiPlatform\Doctrine\Orm\Metadata\Resource\DoctrineOrmResourceCollectionMetadataFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 40) + ->args([ + service('doctrine'), + service('api_platform.doctrine.orm.metadata.resource.metadata_collection_factory.inner'), + ]); + + $services->set('api_platform.doctrine.orm.metadata.resource.link_factory', 'ApiPlatform\Doctrine\Orm\Metadata\Resource\DoctrineOrmLinkFactory') + ->decorate('api_platform.metadata.resource.link_factory', null, 40) + ->args([ + service('doctrine'), + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.doctrine.orm.metadata.resource.link_factory.inner'), + ]); + + $services->set('api_platform.doctrine.orm.links_handler', 'ApiPlatform\Doctrine\Orm\State\LinksHandler') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('doctrine'), + ]) + ->tag('api_platform.doctrine.orm.links_handler', ['key' => 'api_platform.doctrine.orm.links_handler']); +}; diff --git a/src/Symfony/Bundle/Resources/config/doctrine_orm.xml b/src/Symfony/Bundle/Resources/config/doctrine_orm.xml deleted file mode 100644 index 0e0e9e3d5c5..00000000000 --- a/src/Symfony/Bundle/Resources/config/doctrine_orm.xml +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.collection.order_parameter_name% - - - %api_platform.collection.order_nulls_comparison% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.collection.exists_parameter_name% - - - - - - - - - - - - - %api_platform.eager_loading.max_joins% - %api_platform.eager_loading.force_eager% - %api_platform.eager_loading.fetch_partial% - - - - - - - - - - - - - - - - - - - %api_platform.eager_loading.force_eager% - - - - - - - - - - - - - - - - %api_platform.collection.order% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/doctrine_orm_http_cache_purger.php b/src/Symfony/Bundle/Resources/config/doctrine_orm_http_cache_purger.php new file mode 100644 index 00000000000..98a784b09bc --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/doctrine_orm_http_cache_purger.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.doctrine.listener.http_cache.purge', 'ApiPlatform\Symfony\Doctrine\EventListener\PurgeHttpCacheListener') + ->args([ + service('api_platform.http_cache.purger'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.property_accessor'), + service('api_platform.object_mapper')->nullOnInvalid(), + ]) + ->tag('doctrine.event_listener', ['event' => 'preUpdate']) + ->tag('doctrine.event_listener', ['event' => 'onFlush']) + ->tag('doctrine.event_listener', ['event' => 'postFlush']); +}; diff --git a/src/Symfony/Bundle/Resources/config/doctrine_orm_http_cache_purger.xml b/src/Symfony/Bundle/Resources/config/doctrine_orm_http_cache_purger.xml deleted file mode 100644 index 4c5594baf60..00000000000 --- a/src/Symfony/Bundle/Resources/config/doctrine_orm_http_cache_purger.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/doctrine_orm_mercure_publisher.php b/src/Symfony/Bundle/Resources/config/doctrine_orm_mercure_publisher.php new file mode 100644 index 00000000000..66b933797eb --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/doctrine_orm_mercure_publisher.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.doctrine.orm.listener.mercure.publish', 'ApiPlatform\Symfony\Doctrine\EventListener\PublishMercureUpdatesListener') + ->args([ + service('api_platform.resource_class_resolver'), + service('api_platform.iri_converter'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.serializer'), + '%api_platform.formats%', + service('messenger.default_bus')->ignoreOnInvalid(), + service('Symfony\Component\Mercure\HubRegistry'), + service('api_platform.graphql.subscription.subscription_manager')->ignoreOnInvalid(), + service('api_platform.graphql.subscription.mercure_iri_generator')->ignoreOnInvalid(), + null, + '%api_platform.mercure.include_type%', + ]) + ->tag('doctrine.event_listener', ['event' => 'onFlush']) + ->tag('doctrine.event_listener', ['event' => 'postFlush']); +}; diff --git a/src/Symfony/Bundle/Resources/config/doctrine_orm_mercure_publisher.xml b/src/Symfony/Bundle/Resources/config/doctrine_orm_mercure_publisher.xml deleted file mode 100644 index 8f96db54fdb..00000000000 --- a/src/Symfony/Bundle/Resources/config/doctrine_orm_mercure_publisher.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - %api_platform.formats% - - - - - null - %api_platform.mercure.include_type% - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/elasticsearch.php b/src/Symfony/Bundle/Resources/config/elasticsearch.php new file mode 100644 index 00000000000..7a5d04c759a --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/elasticsearch.php @@ -0,0 +1,122 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.elasticsearch.name_converter.inner_fields', 'ApiPlatform\Elasticsearch\Serializer\NameConverter\InnerFieldsNameConverter') + ->args([service('api_platform.name_converter')->ignoreOnInvalid()]); + + $services->set('api_platform.elasticsearch.normalizer.item', 'ApiPlatform\Elasticsearch\Serializer\ItemNormalizer') + ->decorate('api_platform.serializer.normalizer.item', null, 0) + ->args([service('api_platform.elasticsearch.normalizer.item.inner')]); + + $services->set('api_platform.elasticsearch.normalizer.document', 'ApiPlatform\Elasticsearch\Serializer\DocumentNormalizer') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('serializer.mapping.class_metadata_factory'), + service('api_platform.elasticsearch.name_converter.inner_fields'), + service('serializer.property_accessor'), + service('property_info')->ignoreOnInvalid(), + service('serializer.mapping.class_discriminator_resolver')->ignoreOnInvalid(), + null, + '%api_platform.serializer.default_context%', + ]) + ->tag('serializer.normalizer', ['priority' => -922]); + + $services->set('api_platform.elasticsearch.request_body_search_extension.filter') + ->abstract() + ->args([service('api_platform.filter_locator')]); + + $services->set('api_platform.elasticsearch.request_body_search_extension.constant_score_filter', 'ApiPlatform\Elasticsearch\Extension\ConstantScoreFilterExtension') + ->parent('api_platform.elasticsearch.request_body_search_extension.filter') + ->tag('api_platform.elasticsearch.request_body_search_extension.collection', ['priority' => 30]); + + $services->set('api_platform.elasticsearch.request_body_search_extension.sort_filter', 'ApiPlatform\Elasticsearch\Extension\SortFilterExtension') + ->parent('api_platform.elasticsearch.request_body_search_extension.filter') + ->tag('api_platform.elasticsearch.request_body_search_extension.collection', ['priority' => 20]); + + $services->set('api_platform.elasticsearch.request_body_search_extension.sort', 'ApiPlatform\Elasticsearch\Extension\SortExtension') + ->args([ + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.elasticsearch.name_converter.inner_fields'), + '%api_platform.collection.order%', + ]) + ->tag('api_platform.elasticsearch.request_body_search_extension.collection', ['priority' => 10]); + + $services->set('api_platform.elasticsearch.search_filter') + ->abstract() + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.iri_converter'), + service('api_platform.property_accessor'), + service('api_platform.elasticsearch.name_converter.inner_fields'), + ]); + + $services->set('api_platform.elasticsearch.term_filter', 'ApiPlatform\Elasticsearch\Filter\TermFilter') + ->abstract() + ->parent('api_platform.elasticsearch.search_filter'); + + $services->alias('ApiPlatform\Elasticsearch\Filter\TermFilter', 'api_platform.elasticsearch.term_filter'); + + $services->set('api_platform.elasticsearch.match_filter', 'ApiPlatform\Elasticsearch\Filter\MatchFilter') + ->abstract() + ->parent('api_platform.elasticsearch.search_filter'); + + $services->alias('ApiPlatform\Elasticsearch\Filter\MatchFilter', 'api_platform.elasticsearch.match_filter'); + + $services->set('api_platform.elasticsearch.order_filter', 'ApiPlatform\Elasticsearch\Filter\OrderFilter') + ->abstract() + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.elasticsearch.name_converter.inner_fields'), + '%api_platform.collection.order_parameter_name%', + ]); + + $services->alias('ApiPlatform\Elasticsearch\Filter\OrderFilter', 'api_platform.elasticsearch.order_filter'); + + $services->set('api_platform.elasticsearch.state.item_provider', 'ApiPlatform\Elasticsearch\State\ItemProvider') + ->args([ + service('api_platform.elasticsearch.client'), + service('serializer'), + service('api_platform.inflector')->nullOnInvalid(), + ]) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'ApiPlatform\Elasticsearch\State\ItemProvider']) + ->tag('api_platform.state_provider', ['priority' => -100]); + + $services->alias('ApiPlatform\Elasticsearch\State\ItemProvider', 'api_platform.elasticsearch.state.item_provider'); + + $services->set('api_platform.elasticsearch.state.collection_provider', 'ApiPlatform\Elasticsearch\State\CollectionProvider') + ->args([ + service('api_platform.elasticsearch.client'), + service('serializer'), + service('api_platform.pagination'), + tagged_iterator('api_platform.elasticsearch.request_body_search_extension.collection'), + service('api_platform.inflector')->nullOnInvalid(), + ]) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'ApiPlatform\Elasticsearch\State\CollectionProvider']) + ->tag('api_platform.state_provider', ['priority' => -100]); + + $services->alias('ApiPlatform\Elasticsearch\State\CollectionProvider', 'api_platform.elasticsearch.state.collection_provider'); + + $services->set('api_platform.elasticsearch.metadata.resource.metadata_collection_factory', 'ApiPlatform\Elasticsearch\Metadata\Resource\Factory\ElasticsearchProviderResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 40) + ->args([service('api_platform.elasticsearch.metadata.resource.metadata_collection_factory.inner')]); +}; diff --git a/src/Symfony/Bundle/Resources/config/elasticsearch.xml b/src/Symfony/Bundle/Resources/config/elasticsearch.xml deleted file mode 100644 index 1f9efcabbf4..00000000000 --- a/src/Symfony/Bundle/Resources/config/elasticsearch.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - null - %api_platform.serializer.default_context% - - - - - - - - - - - - - - - - - - - - - - %api_platform.collection.order% - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.collection.order_parameter_name% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/filter.php b/src/Symfony/Bundle/Resources/config/filter.php new file mode 100644 index 00000000000..856db31be71 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/filter.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.filter_locator', 'Symfony\Component\DependencyInjection\ServiceLocator') + ->tag('container.service_locator'); +}; diff --git a/src/Symfony/Bundle/Resources/config/filter.xml b/src/Symfony/Bundle/Resources/config/filter.xml deleted file mode 100644 index d3a9214341d..00000000000 --- a/src/Symfony/Bundle/Resources/config/filter.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/graphql.php b/src/Symfony/Bundle/Resources/config/graphql.php new file mode 100644 index 00000000000..45e4915b279 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/graphql.php @@ -0,0 +1,247 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.graphql.executor', 'ApiPlatform\GraphQl\Executor') + ->args([ + '%api_platform.graphql.introspection.enabled%', + '%api_platform.graphql.max_query_complexity%', + '%api_platform.graphql.max_query_depth%', + ]); + + $services->set('api_platform.graphql.resolver_locator', 'Symfony\Component\DependencyInjection\ServiceLocator') + ->tag('container.service_locator'); + + $services->set('api_platform.graphql.iterable_type', 'ApiPlatform\GraphQl\Type\Definition\IterableType') + ->tag('api_platform.graphql.type'); + + $services->set('api_platform.graphql.upload_type', 'ApiPlatform\GraphQl\Type\Definition\UploadType') + ->tag('api_platform.graphql.type'); + + $services->set('api_platform.graphql.type_locator', 'Symfony\Component\DependencyInjection\ServiceLocator') + ->tag('container.service_locator'); + + $services->set('api_platform.graphql.types_container', 'ApiPlatform\GraphQl\Type\TypesContainer'); + + $services->set('api_platform.graphql.types_factory', 'ApiPlatform\GraphQl\Type\TypesFactory') + ->args([service('api_platform.graphql.type_locator')]); + + $services->set('api_platform.graphql.fields_builder_locator', 'Symfony\Component\DependencyInjection\ServiceLocator') + ->args([[service('api_platform.graphql.fields_builder')]]) + ->tag('container.service_locator'); + + $services->set('api_platform.graphql.action.entrypoint', 'ApiPlatform\GraphQl\Action\EntrypointAction') + ->public() + ->args([ + service('api_platform.graphql.schema_builder'), + service('api_platform.graphql.executor'), + service('api_platform.graphql.action.graphiql')->nullOnInvalid(), + service('serializer'), + service('api_platform.graphql.error_handler'), + '%kernel.debug%', + '%api_platform.graphql.graphiql.enabled%', + '%api_platform.graphql.default_ide%', + ]); + + $services->set('api_platform.graphql.action.graphiql', 'ApiPlatform\GraphQl\Action\GraphiQlAction') + ->public() + ->args([ + service('twig'), + service('api_platform.router'), + '%api_platform.graphql.graphiql.enabled%', + '%api_platform.title%', + '%api_platform.asset_package%', + ]); + + $services->set('api_platform.graphql.error_handler', 'ApiPlatform\GraphQl\Error\ErrorHandler'); + + $services->set('api_platform.graphql.subscription.subscription_identifier_generator', 'ApiPlatform\GraphQl\Subscription\SubscriptionIdentifierGenerator'); + + $services->set('api_platform.graphql.cache.subscription') + ->parent('cache.system') + ->tag('cache.pool'); + + $services->set('api_platform.graphql.command.export_command', 'ApiPlatform\Symfony\Bundle\Command\GraphQlExportCommand') + ->args([service('api_platform.graphql.schema_builder')]) + ->tag('console.command'); + + $services->set('api_platform.graphql.type_converter', 'ApiPlatform\GraphQl\Type\TypeConverter') + ->args([ + service('api_platform.graphql.type_builder'), + service('api_platform.graphql.types_container'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + ]); + + $services->set('api_platform.graphql.type_builder', 'ApiPlatform\GraphQl\Type\TypeBuilder') + ->args([ + service('api_platform.graphql.types_container'), + service('api_platform.graphql.resolver.resource_field'), + service('api_platform.graphql.fields_builder_locator'), + service('api_platform.pagination'), + ]); + + $services->set('api_platform.graphql.fields_builder', 'ApiPlatform\GraphQl\Type\FieldsBuilder') + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.graphql.types_container'), + service('api_platform.graphql.type_builder'), + service('api_platform.graphql.type_converter'), + service('api_platform.graphql.resolver.factory'), + service('api_platform.filter_locator'), + service('api_platform.pagination'), + service('api_platform.name_converter')->ignoreOnInvalid(), + '%api_platform.graphql.nesting_separator%', + service('api_platform.inflector')->nullOnInvalid(), + ]); + + $services->set('api_platform.graphql.schema_builder', 'ApiPlatform\GraphQl\Type\SchemaBuilder') + ->args([ + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.graphql.types_factory'), + service('api_platform.graphql.types_container'), + service('api_platform.graphql.fields_builder'), + ]); + + $services->set('api_platform.graphql.serializer.context_builder', 'ApiPlatform\GraphQl\Serializer\SerializerContextBuilder') + ->args([service('api_platform.name_converter')->ignoreOnInvalid()]); + + $services->alias('ApiPlatform\GraphQl\Serializer\SerializerContextBuilderInterface', 'api_platform.graphql.serializer.context_builder'); + + $services->alias('api_platform.graphql.state_provider', 'api_platform.state_provider.locator'); + + $services->alias('api_platform.graphql.state_processor', 'api_platform.graphql.state_processor.normalize'); + + $services->set('api_platform.graphql.state_provider.read', 'ApiPlatform\GraphQl\State\Provider\ReadProvider') + ->decorate('api_platform.graphql.state_provider', null, 500) + ->args([ + service('api_platform.graphql.state_provider.read.inner'), + service('api_platform.symfony.iri_converter'), + service('api_platform.graphql.serializer.context_builder')->ignoreOnInvalid(), + '%api_platform.graphql.nesting_separator%', + ]); + + $services->set('api_platform.graphql.state_provider.parameter', 'ApiPlatform\State\Provider\ParameterProvider') + ->decorate('api_platform.graphql.state_provider', null, 300) + ->args([ + service('api_platform.graphql.state_provider.parameter.inner'), + tagged_locator('api_platform.parameter_provider', 'key'), + ]); + + $services->set('api_platform.graphql.state_provider.resolver', 'ApiPlatform\GraphQl\State\Provider\ResolverProvider') + ->decorate('api_platform.graphql.state_provider', null, 190) + ->args([ + service('api_platform.graphql.state_provider.resolver.inner'), + service('api_platform.graphql.resolver_locator'), + ]); + + $services->set('api_platform.graphql.state_provider.denormalizer', 'ApiPlatform\GraphQl\State\Provider\DenormalizeProvider') + ->decorate('api_platform.graphql.state_provider', null, 300) + ->args([ + service('api_platform.graphql.state_provider.denormalizer.inner'), + service('serializer'), + service('api_platform.graphql.serializer.context_builder'), + ]); + + $services->set('api_platform.graphql.state_processor.subscription', 'ApiPlatform\GraphQl\State\Processor\SubscriptionProcessor') + ->decorate('api_platform.graphql.state_processor', null, 200) + ->args([ + service('api_platform.graphql.state_processor.subscription.inner'), + service('api_platform.graphql.subscription.subscription_manager'), + service('api_platform.graphql.subscription.mercure_iri_generator')->ignoreOnInvalid(), + ]); + + $services->set('api_platform.graphql.state_processor.write', 'ApiPlatform\State\Processor\WriteProcessor') + ->decorate('api_platform.graphql.state_processor', null, 100) + ->args([ + service('api_platform.graphql.state_processor.write.inner'), + service('api_platform.state_processor.locator'), + ]); + + $services->set('api_platform.graphql.state_processor.normalize', 'ApiPlatform\GraphQl\State\Processor\NormalizeProcessor') + ->args([ + service('serializer'), + service('api_platform.graphql.serializer.context_builder'), + service('api_platform.pagination'), + ]); + + $services->set('api_platform.graphql.resolver.factory', 'ApiPlatform\GraphQl\Resolver\Factory\ResolverFactory') + ->args([ + service('api_platform.graphql.state_provider'), + service('api_platform.graphql.state_processor'), + service('api_platform.graphql.runtime_operation_metadata_factory'), + ]); + + $services->set('api_platform.graphql.runtime_operation_metadata_factory', 'ApiPlatform\GraphQl\Metadata\RuntimeOperationMetadataFactory') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.router'), + ]); + + $services->set('api_platform.graphql.resolver.resource_field', 'ApiPlatform\GraphQl\Resolver\ResourceFieldResolver') + ->args([service('api_platform.symfony.iri_converter')]); + + $services->set('api_platform.graphql.normalizer.item', 'ApiPlatform\GraphQl\Serializer\ItemNormalizer') + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.symfony.iri_converter'), + service('api_platform.api.identifiers_extractor'), + service('api_platform.resource_class_resolver'), + service('api_platform.property_accessor'), + service('api_platform.name_converter')->ignoreOnInvalid(), + service('serializer.mapping.class_metadata_factory')->ignoreOnInvalid(), + null, + service('api_platform.metadata.resource.metadata_collection_factory')->ignoreOnInvalid(), + service('api_platform.security.resource_access_checker')->ignoreOnInvalid(), + ]) + ->tag('serializer.normalizer', ['priority' => -890]); + + $services->set('api_platform.graphql.normalizer.object', 'ApiPlatform\GraphQl\Serializer\ObjectNormalizer') + ->args([ + service('serializer.normalizer.object'), + service('api_platform.symfony.iri_converter'), + service('api_platform.api.identifiers_extractor'), + ]) + ->tag('serializer.normalizer', ['priority' => -995]); + + $services->set('api_platform.graphql.subscription.subscription_manager', 'ApiPlatform\GraphQl\Subscription\SubscriptionManager') + ->args([ + service('api_platform.graphql.cache.subscription'), + service('api_platform.graphql.subscription.subscription_identifier_generator'), + service('api_platform.graphql.state_processor.normalize')->ignoreOnInvalid(), + service('api_platform.symfony.iri_converter'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]); + + $services->set('api_platform.graphql.normalizer.error', 'ApiPlatform\GraphQl\Serializer\Exception\ErrorNormalizer') + ->tag('serializer.normalizer', ['priority' => -790]); + + $services->set('api_platform.graphql.normalizer.validation_exception', 'ApiPlatform\GraphQl\Serializer\Exception\ValidationExceptionNormalizer') + ->args(['%api_platform.exception_to_status%']) + ->tag('serializer.normalizer', ['priority' => -780]); + + $services->set('api_platform.graphql.normalizer.http_exception', 'ApiPlatform\GraphQl\Serializer\Exception\HttpExceptionNormalizer') + ->tag('serializer.normalizer', ['priority' => -780]); + + $services->set('api_platform.graphql.normalizer.runtime_exception', 'ApiPlatform\GraphQl\Serializer\Exception\RuntimeExceptionNormalizer') + ->tag('serializer.normalizer', ['priority' => -780]); +}; diff --git a/src/Symfony/Bundle/Resources/config/graphql.xml b/src/Symfony/Bundle/Resources/config/graphql.xml deleted file mode 100644 index d82ab6c25ad..00000000000 --- a/src/Symfony/Bundle/Resources/config/graphql.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - %api_platform.graphql.introspection.enabled% - %api_platform.graphql.max_query_complexity% - %api_platform.graphql.max_query_depth% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %kernel.debug% - %api_platform.graphql.graphiql.enabled% - %api_platform.graphql.default_ide% - - - - - - %api_platform.graphql.graphiql.enabled% - %api_platform.title% - %api_platform.asset_package% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.graphql.nesting_separator% - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.graphql.nesting_separator% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - null - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.exception_to_status% - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/graphql/security.php b/src/Symfony/Bundle/Resources/config/graphql/security.php new file mode 100644 index 00000000000..b2f9c2232ed --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/graphql/security.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.graphql.state_provider.access_checker', 'ApiPlatform\Symfony\Security\State\AccessCheckerProvider') + ->decorate('api_platform.graphql.state_provider.read', null, 0) + ->args([ + service('api_platform.graphql.state_provider.access_checker.inner'), + service('api_platform.security.resource_access_checker'), + ]); + + $services->set('api_platform.graphql.state_provider.access_checker.post_deserialize', 'ApiPlatform\Symfony\Security\State\AccessCheckerProvider') + ->decorate('api_platform.graphql.state_provider.denormalizer', null, 0) + ->args([ + service('api_platform.graphql.state_provider.access_checker.post_deserialize.inner'), + service('api_platform.security.resource_access_checker'), + 'post_denormalize', + ]); + + $services->set('api_platform.graphql.state_provider.access_checker.post_validate', 'ApiPlatform\Symfony\Security\State\AccessCheckerProvider') + ->decorate('api_platform.graphql.state_provider.validate', null, 0) + ->args([ + service('api_platform.graphql.state_provider.access_checker.post_validate.inner'), + service('api_platform.security.resource_access_checker'), + 'post_validate', + ]); + + $services->set('api_platform.graphql.state_provider.access_checker.after_resolver', 'ApiPlatform\Symfony\Security\State\AccessCheckerProvider') + ->decorate('api_platform.graphql.state_provider', null, 170) + ->args([ + service('api_platform.graphql.state_provider.access_checker.after_resolver.inner'), + service('api_platform.security.resource_access_checker'), + 'after_resolver', + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/graphql/security.xml b/src/Symfony/Bundle/Resources/config/graphql/security.xml deleted file mode 100644 index bd88721e6ef..00000000000 --- a/src/Symfony/Bundle/Resources/config/graphql/security.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - post_denormalize - - - - - - post_validate - - - - - - after_resolver - - - diff --git a/src/Symfony/Bundle/Resources/config/graphql/validator.php b/src/Symfony/Bundle/Resources/config/graphql/validator.php new file mode 100644 index 00000000000..0c5f7ed6090 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/graphql/validator.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.graphql.state_provider.validate', 'ApiPlatform\Symfony\Validator\State\ValidateProvider') + ->decorate('api_platform.graphql.state_provider', null, 200) + ->args([ + service('api_platform.graphql.state_provider.validate.inner'), + service('api_platform.validator'), + ]); + + $services->set('api_platform.graphql.state_provider.validate_after_resolver', 'ApiPlatform\Symfony\Validator\State\ValidateProvider') + ->decorate('api_platform.graphql.state_provider', null, 180) + ->args([ + service('api_platform.graphql.state_provider.validate_after_resolver.inner'), + service('api_platform.validator'), + 'canValidateAfterResolver', + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/graphql/validator.xml b/src/Symfony/Bundle/Resources/config/graphql/validator.xml deleted file mode 100644 index fe74a17f24f..00000000000 --- a/src/Symfony/Bundle/Resources/config/graphql/validator.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - canValidateAfterResolver - - - diff --git a/src/Symfony/Bundle/Resources/config/graphql_mercure.php b/src/Symfony/Bundle/Resources/config/graphql_mercure.php new file mode 100644 index 00000000000..03a1d6e4a6a --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/graphql_mercure.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.graphql.subscription.mercure_iri_generator', 'ApiPlatform\GraphQl\Subscription\MercureSubscriptionIriGenerator') + ->args([ + service('router.request_context'), + service('Symfony\Component\Mercure\HubRegistry'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/graphql_mercure.xml b/src/Symfony/Bundle/Resources/config/graphql_mercure.xml deleted file mode 100644 index 74974da6650..00000000000 --- a/src/Symfony/Bundle/Resources/config/graphql_mercure.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/hal.php b/src/Symfony/Bundle/Resources/config/hal.php new file mode 100644 index 00000000000..a2d40c50d30 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/hal.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.hal.json_schema.schema_factory', 'ApiPlatform\Hal\JsonSchema\SchemaFactory') + ->decorate('api_platform.json_schema.schema_factory', null, 0) + ->args([ + service('api_platform.hal.json_schema.schema_factory.inner'), + service('api_platform.json_schema.definition_name_factory')->ignoreOnInvalid(), + service('api_platform.metadata.resource.metadata_collection_factory')->ignoreOnInvalid(), + ]); + + $services->set('api_platform.hal.encoder', 'ApiPlatform\Serializer\JsonEncoder') + ->args(['jsonhal']) + ->tag('serializer.encoder'); + + $services->set('api_platform.hal.normalizer.entrypoint', 'ApiPlatform\Hal\Serializer\EntrypointNormalizer') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.iri_converter'), + service('api_platform.router'), + ]) + ->tag('serializer.normalizer', ['priority' => -800]); + + $services->set('api_platform.hal.normalizer.collection', 'ApiPlatform\Hal\Serializer\CollectionNormalizer') + ->args([ + service('api_platform.resource_class_resolver'), + '%api_platform.collection.pagination.page_parameter_name%', + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('serializer.normalizer', ['priority' => -985]); + + $services->set('api_platform.hal.normalizer.item', 'ApiPlatform\Hal\Serializer\ItemNormalizer') + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.property_accessor'), + service('api_platform.name_converter')->ignoreOnInvalid(), + service('serializer.mapping.class_metadata_factory')->ignoreOnInvalid(), + [], + service('api_platform.metadata.resource.metadata_collection_factory')->ignoreOnInvalid(), + service('api_platform.security.resource_access_checker')->ignoreOnInvalid(), + service('api_platform.http_cache.tag_collector')->ignoreOnInvalid(), + ]) + ->tag('serializer.normalizer', ['priority' => -890]); + + $services->set('api_platform.hal.normalizer.object', 'ApiPlatform\Hal\Serializer\ObjectNormalizer') + ->args([ + service('serializer.normalizer.object'), + service('api_platform.iri_converter'), + ]) + ->tag('serializer.normalizer', ['priority' => -995]); +}; diff --git a/src/Symfony/Bundle/Resources/config/hal.xml b/src/Symfony/Bundle/Resources/config/hal.xml deleted file mode 100644 index 7ca544aea59..00000000000 --- a/src/Symfony/Bundle/Resources/config/hal.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - jsonhal - - - - - - - - - - - - - - - %api_platform.collection.pagination.page_parameter_name% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/http_cache.php b/src/Symfony/Bundle/Resources/config/http_cache.php new file mode 100644 index 00000000000..2bac73ec4f6 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/http_cache.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.http_cache.processor.add_headers', 'ApiPlatform\HttpCache\State\AddHeadersProcessor') + ->decorate('api_platform.state_processor.respond', null, 0) + ->args([ + service('api_platform.http_cache.processor.add_headers.inner'), + '%api_platform.http_cache.etag%', + '%api_platform.http_cache.max_age%', + '%api_platform.http_cache.shared_max_age%', + '%api_platform.http_cache.vary%', + '%api_platform.http_cache.public%', + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/http_cache.xml b/src/Symfony/Bundle/Resources/config/http_cache.xml deleted file mode 100644 index 5a9a4b494e8..00000000000 --- a/src/Symfony/Bundle/Resources/config/http_cache.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - %api_platform.http_cache.etag% - %api_platform.http_cache.max_age% - %api_platform.http_cache.shared_max_age% - %api_platform.http_cache.vary% - %api_platform.http_cache.public% - - - diff --git a/src/Symfony/Bundle/Resources/config/http_cache_purger.php b/src/Symfony/Bundle/Resources/config/http_cache_purger.php new file mode 100644 index 00000000000..7ad4540ccc5 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/http_cache_purger.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->alias('api_platform.http_cache.purger.varnish', 'api_platform.http_cache.purger.varnish.ban'); + + $services->set('api_platform.http_cache.purger.varnish.ban', 'ApiPlatform\HttpCache\VarnishPurger') + ->args([tagged_iterator('api_platform.http_cache.http_client')]); + + $services->set('api_platform.http_cache.purger.varnish.xkey', 'ApiPlatform\HttpCache\VarnishXKeyPurger') + ->args([ + tagged_iterator('api_platform.http_cache.http_client'), + '%api_platform.http_cache.invalidation.max_header_length%', + '%api_platform.http_cache.invalidation.xkey.glue%', + ]); + + $services->set('api_platform.http_cache.purger.souin', 'ApiPlatform\HttpCache\SouinPurger') + ->args([ + tagged_iterator('api_platform.http_cache.http_client'), + '%api_platform.http_cache.invalidation.max_header_length%', + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/http_cache_purger.xml b/src/Symfony/Bundle/Resources/config/http_cache_purger.xml deleted file mode 100644 index 33fbe506627..00000000000 --- a/src/Symfony/Bundle/Resources/config/http_cache_purger.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - %api_platform.http_cache.invalidation.max_header_length% - %api_platform.http_cache.invalidation.xkey.glue% - - - - %api_platform.http_cache.invalidation.max_header_length% - - - diff --git a/src/Symfony/Bundle/Resources/config/hydra.php b/src/Symfony/Bundle/Resources/config/hydra.php new file mode 100644 index 00000000000..ad88704ecb4 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/hydra.php @@ -0,0 +1,94 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.hydra.json_schema.schema_factory', 'ApiPlatform\Hydra\JsonSchema\SchemaFactory') + ->decorate('api_platform.json_schema.schema_factory', null, 0) + ->args([ + service('api_platform.hydra.json_schema.schema_factory.inner'), + '%api_platform.serializer.default_context%', + service('api_platform.json_schema.definition_name_factory')->ignoreOnInvalid(), + service('api_platform.metadata.resource.metadata_collection_factory')->ignoreOnInvalid(), + ]); + + $services->set('api_platform.hydra.normalizer.documentation', 'ApiPlatform\Hydra\Serializer\DocumentationNormalizer') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.router'), + service('api_platform.name_converter')->ignoreOnInvalid(), + '%api_platform.serializer.default_context%', + '%api_platform.enable_entrypoint%', + ]) + ->tag('serializer.normalizer', ['priority' => -800]); + + $services->set('api_platform.hydra.normalizer.constraint_violation_list', 'ApiPlatform\Hydra\Serializer\ConstraintViolationListNormalizer') + ->args([ + '%api_platform.validator.serialize_payload_fields%', + service('api_platform.name_converter')->ignoreOnInvalid(), + '%api_platform.serializer.default_context%', + ]) + ->tag('serializer.normalizer', ['priority' => -780]); + + $services->set('api_platform.hydra.normalizer.entrypoint', 'ApiPlatform\Hydra\Serializer\EntrypointNormalizer') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.iri_converter'), + service('api_platform.router'), + ]) + ->tag('serializer.normalizer', ['priority' => -800]); + + $services->set('api_platform.hydra.normalizer.collection', 'ApiPlatform\Hydra\Serializer\CollectionNormalizer') + ->args([ + service('api_platform.jsonld.context_builder'), + service('api_platform.resource_class_resolver'), + service('api_platform.iri_converter'), + '%api_platform.serializer.default_context%', + ]) + ->tag('serializer.normalizer', ['priority' => -985]); + + $services->set('api_platform.hydra.normalizer.partial_collection_view', 'ApiPlatform\Hydra\Serializer\PartialCollectionViewNormalizer') + ->decorate('api_platform.hydra.normalizer.collection', null, 0) + ->args([ + service('api_platform.hydra.normalizer.partial_collection_view.inner'), + '%api_platform.collection.pagination.page_parameter_name%', + '%api_platform.collection.pagination.enabled_parameter_name%', + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.property_accessor'), + '%api_platform.url_generation_strategy%', + '%api_platform.serializer.default_context%', + ]); + + $services->set('api_platform.hydra.normalizer.collection_filters', 'ApiPlatform\Hydra\Serializer\CollectionFiltersNormalizer') + ->decorate('api_platform.hydra.normalizer.collection', null, 0) + ->args([ + service('api_platform.hydra.normalizer.collection_filters.inner'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.filter_locator'), + '%api_platform.serializer.default_context%', + ]); + + $services->set('api_platform.hydra.name_converter.hydra_prefix', 'ApiPlatform\Hydra\Serializer\HydraPrefixNameConverter') + ->decorate('api_platform.name_converter', null, 0) + ->args([ + service('api_platform.hydra.name_converter.hydra_prefix.inner'), + '%api_platform.serializer.default_context%', + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/hydra.xml b/src/Symfony/Bundle/Resources/config/hydra.xml deleted file mode 100644 index ef9dda6ad7a..00000000000 --- a/src/Symfony/Bundle/Resources/config/hydra.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - %api_platform.serializer.default_context% - - - - - - - - - - - %api_platform.serializer.default_context% - %api_platform.enable_entrypoint% - - - - - - - %api_platform.validator.serialize_payload_fields% - - %api_platform.serializer.default_context% - - - - - - - - - - - - - - - - - %api_platform.serializer.default_context% - - - - - - - - %api_platform.collection.pagination.page_parameter_name% - %api_platform.collection.pagination.enabled_parameter_name% - - - %api_platform.url_generation_strategy% - %api_platform.serializer.default_context% - - - - - - - - %api_platform.serializer.default_context% - - - - - %api_platform.serializer.default_context% - - - - diff --git a/src/Symfony/Bundle/Resources/config/json_schema.php b/src/Symfony/Bundle/Resources/config/json_schema.php new file mode 100644 index 00000000000..8f0fc1f4a06 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/json_schema.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.json_schema.schema_factory', 'ApiPlatform\JsonSchema\SchemaFactory') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.name_converter')->ignoreOnInvalid(), + service('api_platform.resource_class_resolver'), + [], + service('api_platform.json_schema.definition_name_factory')->ignoreOnInvalid(), + ]); + + $services->alias('ApiPlatform\JsonSchema\SchemaFactoryInterface', 'api_platform.json_schema.schema_factory'); + + $services->set('api_platform.json_schema.json_schema_generate_command', 'ApiPlatform\JsonSchema\Command\JsonSchemaGenerateCommand') + ->args([ + service('api_platform.json_schema.schema_factory'), + '%api_platform.formats%', + ]) + ->tag('console.command'); + + $services->set('api_platform.json_schema.metadata.property.metadata_factory.schema', 'ApiPlatform\JsonSchema\Metadata\Property\Factory\SchemaPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 10) + ->args([ + service('api_platform.resource_class_resolver'), + service('api_platform.json_schema.metadata.property.metadata_factory.schema.inner'), + ]); + + $services->set('api_platform.json_schema.backward_compatible_schema_factory', 'ApiPlatform\JsonSchema\BackwardCompatibleSchemaFactory') + ->decorate('api_platform.json_schema.schema_factory', null, -2) + ->args([service('api_platform.json_schema.backward_compatible_schema_factory.inner')]); + + $services->set('api_platform.json_schema.definition_name_factory', 'ApiPlatform\JsonSchema\DefinitionNameFactory'); +}; diff --git a/src/Symfony/Bundle/Resources/config/json_schema.xml b/src/Symfony/Bundle/Resources/config/json_schema.xml deleted file mode 100644 index d905b14c7cb..00000000000 --- a/src/Symfony/Bundle/Resources/config/json_schema.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - %api_platform.formats% - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/common.php b/src/Symfony/Bundle/Resources/config/json_streamer/common.php new file mode 100644 index 00000000000..ae66310d21d --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/json_streamer/common.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.jsonld.json_streamer.stream_writer', 'Symfony\Component\JsonStreamer\JsonStreamWriter') + ->args([ + tagged_locator('json_streamer.value_transformer'), + service('api_platform.jsonld.json_streamer.write.property_metadata_loader'), + '%.json_streamer.stream_writers_dir.jsonld%', + ]); + + $services->set('api_platform.jsonld.json_streamer.stream_reader', 'Symfony\Component\JsonStreamer\JsonStreamReader') + ->args([ + tagged_locator('json_streamer.value_transformer'), + service('json_streamer.read.property_metadata_loader'), + '%.json_streamer.stream_readers_dir.jsonld%', + '%.json_streamer.lazy_ghosts_dir.jsonld%', + ]); + + $services->set('api_platform.jsonld.json_streamer.write.property_metadata_loader', 'ApiPlatform\JsonLd\JsonStreamer\WritePropertyMetadataLoader') + ->args([ + service('json_streamer.write.property_metadata_loader'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + ]); + + $services->set('api_platform.jsonld.json_streamer.write.value_transformer.iri', 'ApiPlatform\JsonLd\JsonStreamer\ValueTransformer\IriValueTransformer') + ->args([service('api_platform.iri_converter')]) + ->tag('json_streamer.value_transformer'); + + $services->set('api_platform.jsonld.json_streamer.write.value_transformer.type', 'ApiPlatform\JsonLd\JsonStreamer\ValueTransformer\TypeValueTransformer') + ->args([ + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('json_streamer.value_transformer'); + + $services->set('api_platform.jsonld.json_streamer.write.value_transformer.context', 'ApiPlatform\JsonLd\JsonStreamer\ValueTransformer\ContextValueTransformer') + ->args([service('api_platform.router')]) + ->tag('json_streamer.value_transformer'); +}; diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/common.xml b/src/Symfony/Bundle/Resources/config/json_streamer/common.xml deleted file mode 100644 index dfa97ccb8f7..00000000000 --- a/src/Symfony/Bundle/Resources/config/json_streamer/common.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - %.json_streamer.stream_writers_dir.jsonld% - - - - - - %.json_streamer.stream_readers_dir.jsonld% - %.json_streamer.lazy_ghosts_dir.jsonld% - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/events.php b/src/Symfony/Bundle/Resources/config/json_streamer/events.php new file mode 100644 index 00000000000..a2a513a561d --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/json_streamer/events.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.jsonld.state_processor.json_streamer', 'ApiPlatform\Hydra\State\JsonStreamerProcessor') + ->args([ + null, + service('api_platform.jsonld.json_streamer.stream_writer'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.operation.metadata_factory'), + '%api_platform.collection.pagination.page_parameter_name%', + '%api_platform.collection.pagination.enabled_parameter_name%', + '%api_platform.url_generation_strategy%', + ]); + + $services->set('api_platform.jsonld.state_provider.json_streamer', 'ApiPlatform\Hydra\State\JsonStreamerProvider') + ->args([ + null, + service('api_platform.jsonld.json_streamer.stream_reader'), + ]); + + $services->set('api_platform.state_processor.json_streamer', 'ApiPlatform\Serializer\State\JsonStreamerProcessor') + ->args([ + null, + service('json_streamer.stream_writer'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.operation.metadata_factory'), + ]); + + $services->set('api_platform.state_provider.json_streamer', 'ApiPlatform\Serializer\State\JsonStreamerProvider') + ->args([ + null, + service('json_streamer.stream_reader'), + ]); + + $services->set('api_platform.listener.request.json_streamer_deserialize', 'ApiPlatform\Symfony\EventListener\JsonStreamerDeserializeListener') + ->args([ + service('api_platform.state_provider.json_streamer'), + 'json', + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.request', 'method' => 'onKernelRequest', 'priority' => 3]); + + $services->set('api_platform.listener.request.jsonld_streamer_deserialize', 'ApiPlatform\Symfony\EventListener\JsonStreamerDeserializeListener') + ->args([ + service('api_platform.jsonld.state_provider.json_streamer'), + 'jsonld', + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.request', 'method' => 'onKernelRequest', 'priority' => 3]); + + $services->set('api_platform.listener.view.json_streamer_serialize', 'ApiPlatform\Symfony\EventListener\JsonStreamerSerializeListener') + ->args([ + service('api_platform.state_processor.json_streamer'), + 'json', + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.view', 'method' => 'onKernelView', 'priority' => 17]); + + $services->set('api_platform.listener.view.jsonld_streamer_serialize', 'ApiPlatform\Symfony\EventListener\JsonStreamerSerializeListener') + ->args([ + service('api_platform.jsonld.state_processor.json_streamer'), + 'jsonld', + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.view', 'method' => 'onKernelView', 'priority' => 17]); +}; diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/events.xml b/src/Symfony/Bundle/Resources/config/json_streamer/events.xml deleted file mode 100644 index 40d5ea7059c..00000000000 --- a/src/Symfony/Bundle/Resources/config/json_streamer/events.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - null - - - - - %api_platform.collection.pagination.page_parameter_name% - %api_platform.collection.pagination.enabled_parameter_name% - %api_platform.url_generation_strategy% - - - - null - - - - - null - - - - - - - - null - - - - - - json - - - - - - - jsonld - - - - - - - json - - - - - - - jsonld - - - - - diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/hydra.php b/src/Symfony/Bundle/Resources/config/json_streamer/hydra.php new file mode 100644 index 00000000000..43bb5d07f8d --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/json_streamer/hydra.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.jsonld.state_processor.json_streamer', 'ApiPlatform\Hydra\State\JsonStreamerProcessor') + ->decorate('api_platform.state_processor.main', null, 190) + ->args([ + service('api_platform.jsonld.state_processor.json_streamer.inner'), + service('api_platform.jsonld.json_streamer.stream_writer'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.operation.metadata_factory'), + '%api_platform.collection.pagination.page_parameter_name%', + '%api_platform.collection.pagination.enabled_parameter_name%', + '%api_platform.url_generation_strategy%', + ]); + + $services->set('api_platform.jsonld.state_provider.json_streamer', 'ApiPlatform\Hydra\State\JsonStreamerProvider') + ->decorate('api_platform.state_provider.main', null, 310) + ->args([ + service('api_platform.jsonld.state_provider.json_streamer.inner'), + service('api_platform.jsonld.json_streamer.stream_reader'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/hydra.xml b/src/Symfony/Bundle/Resources/config/json_streamer/hydra.xml deleted file mode 100644 index 4caf369befe..00000000000 --- a/src/Symfony/Bundle/Resources/config/json_streamer/hydra.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - %api_platform.collection.pagination.page_parameter_name% - %api_platform.collection.pagination.enabled_parameter_name% - %api_platform.url_generation_strategy% - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/json.php b/src/Symfony/Bundle/Resources/config/json_streamer/json.php new file mode 100644 index 00000000000..88c3665c9d8 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/json_streamer/json.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_processor.json_streamer', 'ApiPlatform\Serializer\State\JsonStreamerProcessor') + ->decorate('api_platform.state_processor.main', null, 190) + ->args([ + service('api_platform.state_processor.json_streamer.inner'), + service('json_streamer.stream_writer'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.operation.metadata_factory'), + ]); + + $services->set('api_platform.state_provider.json_streamer', 'ApiPlatform\Serializer\State\JsonStreamerProvider') + ->decorate('api_platform.state_provider.main', null, 310) + ->args([ + service('api_platform.state_provider.json_streamer.inner'), + service('json_streamer.stream_reader'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/json.xml b/src/Symfony/Bundle/Resources/config/json_streamer/json.xml deleted file mode 100644 index 9e9d6fbacd1..00000000000 --- a/src/Symfony/Bundle/Resources/config/json_streamer/json.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/jsonapi.php b/src/Symfony/Bundle/Resources/config/jsonapi.php new file mode 100644 index 00000000000..908fe4912fd --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/jsonapi.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.jsonapi.json_schema.schema_factory', 'ApiPlatform\JsonApi\JsonSchema\SchemaFactory') + ->decorate('api_platform.json_schema.schema_factory', null, 0) + ->args([ + service('api_platform.jsonapi.json_schema.schema_factory.inner'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.resource.metadata_collection_factory')->ignoreOnInvalid(), + service('api_platform.json_schema.definition_name_factory')->ignoreOnInvalid(), + ]); + + $services->set('api_platform.jsonapi.encoder', 'ApiPlatform\Serializer\JsonEncoder') + ->args(['jsonapi']) + ->tag('serializer.encoder'); + + $services->set('api_platform.jsonapi.name_converter.reserved_attribute_name', 'ApiPlatform\JsonApi\Serializer\ReservedAttributeNameConverter') + ->args([service('api_platform.name_converter')->ignoreOnInvalid()]); + + $services->set('api_platform.jsonapi.normalizer.entrypoint', 'ApiPlatform\JsonApi\Serializer\EntrypointNormalizer') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.iri_converter'), + service('api_platform.router'), + ]) + ->tag('serializer.normalizer', ['priority' => -800]); + + $services->set('api_platform.jsonapi.normalizer.collection', 'ApiPlatform\JsonApi\Serializer\CollectionNormalizer') + ->args([ + service('api_platform.resource_class_resolver'), + '%api_platform.collection.pagination.page_parameter_name%', + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('serializer.normalizer', ['priority' => -985]); + + $services->set('api_platform.jsonapi.normalizer.item', 'ApiPlatform\JsonApi\Serializer\ItemNormalizer') + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.property_accessor'), + service('api_platform.jsonapi.name_converter.reserved_attribute_name'), + service('serializer.mapping.class_metadata_factory')->ignoreOnInvalid(), + [], + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.security.resource_access_checker')->ignoreOnInvalid(), + service('api_platform.http_cache.tag_collector')->ignoreOnInvalid(), + ]) + ->tag('serializer.normalizer', ['priority' => -890]); + + $services->set('api_platform.jsonapi.normalizer.object', 'ApiPlatform\JsonApi\Serializer\ObjectNormalizer') + ->args([ + service('serializer.normalizer.object'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('serializer.normalizer', ['priority' => -995]); + + $services->set('api_platform.jsonapi.normalizer.constraint_violation_list', 'ApiPlatform\JsonApi\Serializer\ConstraintViolationListNormalizer') + ->args([ + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.jsonapi.name_converter.reserved_attribute_name'), + ]) + ->tag('serializer.normalizer', ['priority' => -780]); + + $services->set('api_platform.jsonapi.normalizer.error', 'ApiPlatform\JsonApi\Serializer\ErrorNormalizer') + ->args([service('api_platform.jsonapi.normalizer.item')]) + ->tag('serializer.normalizer', ['priority' => -790]); +}; diff --git a/src/Symfony/Bundle/Resources/config/jsonapi.xml b/src/Symfony/Bundle/Resources/config/jsonapi.xml deleted file mode 100644 index 40776f2fff7..00000000000 --- a/src/Symfony/Bundle/Resources/config/jsonapi.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - jsonapi - - - - - - - - - - - - - - - - - - - %api_platform.collection.pagination.page_parameter_name% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/jsonld.php b/src/Symfony/Bundle/Resources/config/jsonld.php new file mode 100644 index 00000000000..d3d1007cd09 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/jsonld.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.jsonld.context_builder', 'ApiPlatform\JsonLd\ContextBuilder') + ->args([ + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.router'), + service('api_platform.symfony.iri_converter.skolem'), + service('api_platform.name_converter'), + '%api_platform.serializer.default_context%', + ]); + + $services->set('api_platform.jsonld.normalizer.item', 'ApiPlatform\JsonLd\Serializer\ItemNormalizer') + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.jsonld.context_builder'), + service('api_platform.property_accessor'), + service('api_platform.name_converter')->ignoreOnInvalid(), + service('serializer.mapping.class_metadata_factory')->ignoreOnInvalid(), + '%api_platform.serializer.default_context%', + service('api_platform.security.resource_access_checker')->ignoreOnInvalid(), + service('api_platform.http_cache.tag_collector')->ignoreOnInvalid(), + ]) + ->tag('serializer.normalizer', ['priority' => -890]); + + $services->set('api_platform.jsonld.normalizer.error', 'ApiPlatform\JsonLd\Serializer\ErrorNormalizer') + ->args([ + service('api_platform.jsonld.normalizer.item'), + '%api_platform.serializer.default_context%', + ]) + ->tag('serializer.normalizer', ['priority' => -880]); + + $services->set('api_platform.jsonld.normalizer.object', 'ApiPlatform\JsonLd\Serializer\ObjectNormalizer') + ->args([ + service('serializer.normalizer.object'), + service('api_platform.iri_converter'), + service('api_platform.jsonld.context_builder'), + ]) + ->tag('serializer.normalizer', ['priority' => -995]); + + $services->set('api_platform.jsonld.normalizer.validation_exception', 'ApiPlatform\Symfony\Validator\Serializer\ValidationExceptionNormalizer') + ->args([ + service('api_platform.jsonld.normalizer.error'), + service('api_platform.name_converter')->ignoreOnInvalid(), + ]) + ->tag('serializer.normalizer', ['priority' => -800]); + + $services->set('api_platform.jsonld.encoder', 'ApiPlatform\Serializer\JsonEncoder') + ->args([ + 'jsonld', + service('serializer.json.encoder')->nullOnInvalid(), + ]) + ->tag('serializer.encoder'); +}; diff --git a/src/Symfony/Bundle/Resources/config/jsonld.xml b/src/Symfony/Bundle/Resources/config/jsonld.xml deleted file mode 100644 index 6bb7ea31d1d..00000000000 --- a/src/Symfony/Bundle/Resources/config/jsonld.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - %api_platform.serializer.default_context% - - - - - - - - - - - - - - - %api_platform.serializer.default_context% - - - - - - - - - - %api_platform.serializer.default_context% - - - - - - - - - - - - - - - - - - - - - jsonld - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/link_security.php b/src/Symfony/Bundle/Resources/config/link_security.php new file mode 100644 index 00000000000..a66112d19a8 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/link_security.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_provider.read_link', 'ApiPlatform\State\ParameterProvider\ReadLinkParameterProvider') + ->args([ + service('api_platform.state_provider.locator'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('api_platform.parameter_provider', ['key' => 'ApiPlatform\State\ParameterProvider\ReadLinkParameterProvider', 'priority' => -890]); +}; diff --git a/src/Symfony/Bundle/Resources/config/link_security.xml b/src/Symfony/Bundle/Resources/config/link_security.xml deleted file mode 100644 index 8bf049c781a..00000000000 --- a/src/Symfony/Bundle/Resources/config/link_security.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/maker.php b/src/Symfony/Bundle/Resources/config/maker.php new file mode 100644 index 00000000000..fad89af1b9b --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/maker.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.maker.command.state_processor', 'ApiPlatform\Symfony\Maker\MakeStateProcessor') + ->args([service('api_platform.metadata.resource.name_collection_factory')]) + ->tag('maker.command'); + + $services->set('api_platform.maker.command.state_provider', 'ApiPlatform\Symfony\Maker\MakeStateProvider') + ->args([service('api_platform.metadata.resource.name_collection_factory')]) + ->tag('maker.command'); + + $services->set('api_platform.maker.command.filter', 'ApiPlatform\Symfony\Maker\MakeFilter') + ->args([service('api_platform.metadata.resource.name_collection_factory')]) + ->tag('maker.command'); +}; diff --git a/src/Symfony/Bundle/Resources/config/maker.xml b/src/Symfony/Bundle/Resources/config/maker.xml deleted file mode 100644 index ce87f360c4c..00000000000 --- a/src/Symfony/Bundle/Resources/config/maker.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/messenger.php b/src/Symfony/Bundle/Resources/config/messenger.php new file mode 100644 index 00000000000..9eadd0dad5a --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/messenger.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->alias('api_platform.message_bus', 'messenger.default_bus'); + + $services->set('api_platform.messenger.metadata.resource.metadata_collection_factory', 'ApiPlatform\Symfony\Messenger\Metadata\MessengerResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 50) + ->args([service('api_platform.messenger.metadata.resource.metadata_collection_factory.inner')]); + + $services->set('ApiPlatform\Symfony\Messenger\Processor', 'ApiPlatform\Symfony\Messenger\Processor') + ->args([service('api_platform.message_bus')]) + ->tag('api_platform.state_processor', ['priority' => -900]); +}; diff --git a/src/Symfony/Bundle/Resources/config/messenger.xml b/src/Symfony/Bundle/Resources/config/messenger.xml deleted file mode 100644 index 8e80e617450..00000000000 --- a/src/Symfony/Bundle/Resources/config/messenger.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/links.php b/src/Symfony/Bundle/Resources/config/metadata/links.php new file mode 100644 index 00000000000..2e8e03680bd --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/links.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.metadata.resource.link_factory', 'ApiPlatform\Metadata\Resource\Factory\LinkFactory') + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.resource_class_resolver'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/links.xml b/src/Symfony/Bundle/Resources/config/metadata/links.xml deleted file mode 100644 index 8a0e844e60c..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/links.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/mutator.php b/src/Symfony/Bundle/Resources/config/metadata/mutator.php new file mode 100644 index 00000000000..7102321ed5d --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/mutator.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.metadata.mutator_collection.resource', 'ApiPlatform\Metadata\Mutator\ResourceResourceMutatorCollection'); + + $services->set('api_platform.metadata.mutator_collection.operation', 'ApiPlatform\Metadata\Mutator\OperationResourceMutatorCollection'); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/mutator.xml b/src/Symfony/Bundle/Resources/config/metadata/mutator.xml deleted file mode 100644 index bbb78bfbd3a..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/mutator.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/operation.php b/src/Symfony/Bundle/Resources/config/metadata/operation.php new file mode 100644 index 00000000000..66127b8fddf --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/operation.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.metadata.operation.metadata_factory', 'ApiPlatform\Metadata\Operation\Factory\OperationMetadataFactory') + ->args([ + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]); + + $services->alias('ApiPlatform\Metadata\Operation\Factory\OperationMetadataFactoryInterface', 'api_platform.metadata.operation.metadata_factory'); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/operation.xml b/src/Symfony/Bundle/Resources/config/metadata/operation.xml deleted file mode 100644 index bbfdf209878..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/operation.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/php.php b/src/Symfony/Bundle/Resources/config/metadata/php.php new file mode 100644 index 00000000000..1b07fb857bd --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/php.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.metadata.resource_extractor.php_file', 'ApiPlatform\Metadata\Extractor\PhpFileResourceExtractor') + ->args([ + [], + service('service_container'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/php.xml b/src/Symfony/Bundle/Resources/config/metadata/php.xml deleted file mode 100644 index ef476517816..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/php.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/php_doc.php b/src/Symfony/Bundle/Resources/config/metadata/php_doc.php new file mode 100644 index 00000000000..e01b7101714 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/php_doc.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.php_doc', 'ApiPlatform\Metadata\Resource\Factory\PhpDocResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 200) + ->args([service('api_platform.metadata.resource.metadata_collection_factory.php_doc.inner')]); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/php_doc.xml b/src/Symfony/Bundle/Resources/config/metadata/php_doc.xml deleted file mode 100644 index 3e1526319d0..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/php_doc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/property.php b/src/Symfony/Bundle/Resources/config/metadata/property.php new file mode 100644 index 00000000000..2a0dc99f5ed --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/property.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->alias('api_platform.metadata.property.metadata_factory', 'api_platform.metadata.property.metadata_factory.xml'); + + $services->alias('ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface', 'api_platform.metadata.property.metadata_factory'); + + $services->set('api_platform.metadata.property.metadata_factory.property_info', 'ApiPlatform\Metadata\Property\Factory\PropertyInfoPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 40) + ->args([ + service('api_platform.property_info'), + service('api_platform.metadata.property.metadata_factory.property_info.inner'), + ]); + + $services->set('api_platform.metadata.property.metadata_factory.attribute', 'ApiPlatform\Metadata\Property\Factory\AttributePropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 35) + ->args([service('api_platform.metadata.property.metadata_factory.attribute.inner')]); + + $services->set('api_platform.metadata.property.metadata_factory.serializer', 'ApiPlatform\Metadata\Property\Factory\SerializerPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 30) + ->args([ + service('serializer.mapping.class_metadata_factory'), + service('api_platform.metadata.property.metadata_factory.serializer.inner'), + service('api_platform.resource_class_resolver'), + ]); + + $services->set('api_platform.metadata.property.metadata_factory.cached', 'ApiPlatform\Metadata\Property\Factory\CachedPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, -10) + ->args([ + service('api_platform.cache.metadata.property'), + service('api_platform.metadata.property.metadata_factory.cached.inner'), + ]); + + $services->set('api_platform.metadata.property.metadata_factory.default_property', 'ApiPlatform\Metadata\Property\Factory\DefaultPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 30) + ->args([service('api_platform.metadata.property.metadata_factory.default_property.inner')]); + + $services->set('api_platform.metadata.property.metadata_factory.identifier', 'ApiPlatform\Metadata\Property\Factory\IdentifierPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 30) + ->args([ + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.property.metadata_factory.identifier.inner'), + ]); + + $services->set('api_platform.metadata.property.metadata_factory.xml', 'ApiPlatform\Metadata\Property\Factory\ExtractorPropertyMetadataFactory') + ->args([service('api_platform.metadata.property_extractor.xml')]); + + $services->set('api_platform.cache.metadata.property') + ->parent('cache.system') + ->tag('cache.pool'); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/property.xml b/src/Symfony/Bundle/Resources/config/metadata/property.xml deleted file mode 100644 index 2bcbc35cb66..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/property.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/property_name.php b/src/Symfony/Bundle/Resources/config/metadata/property_name.php new file mode 100644 index 00000000000..6c971b231eb --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/property_name.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->alias('api_platform.metadata.property.name_collection_factory', 'api_platform.metadata.property.name_collection_factory.property_info'); + + $services->alias('ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface', 'api_platform.metadata.property.name_collection_factory'); + + $services->set('api_platform.metadata.property.name_collection_factory.property_info', 'ApiPlatform\Metadata\Property\Factory\PropertyInfoPropertyNameCollectionFactory') + ->args([service('api_platform.property_info')]); + + $services->set('api_platform.metadata.property.name_collection_factory.cached', 'ApiPlatform\Metadata\Property\Factory\CachedPropertyNameCollectionFactory') + ->decorate('api_platform.metadata.property.name_collection_factory', null, -10) + ->args([ + service('api_platform.cache.metadata.property'), + service('api_platform.metadata.property.name_collection_factory.cached.inner'), + ]); + + $services->set('api_platform.metadata.property.name_collection_factory.xml', 'ApiPlatform\Metadata\Property\Factory\ExtractorPropertyNameCollectionFactory') + ->decorate('api_platform.metadata.property.name_collection_factory', null, 0) + ->args([ + service('api_platform.metadata.property_extractor.xml'), + service('api_platform.metadata.property.name_collection_factory.xml.inner'), + ]); + + $services->set('api_platform.metadata.property.name_collection_factory.concerns', 'ApiPlatform\Metadata\Property\Factory\ConcernsPropertyNameCollectionMetadataFactory') + ->decorate('api_platform.metadata.property.name_collection_factory', null, 0) + ->args([service('api_platform.metadata.property.name_collection_factory.concerns.inner')]); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/property_name.xml b/src/Symfony/Bundle/Resources/config/metadata/property_name.xml deleted file mode 100644 index 5828fda6aed..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/property_name.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/resource.php b/src/Symfony/Bundle/Resources/config/metadata/resource.php new file mode 100644 index 00000000000..60ddc6336a6 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/resource.php @@ -0,0 +1,141 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->alias('api_platform.metadata.resource.metadata_collection_factory', 'api_platform.metadata.resource.metadata_collection_factory.attributes'); + + $services->alias('ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface', 'api_platform.metadata.resource.metadata_collection_factory'); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.attributes', 'ApiPlatform\Metadata\Resource\Factory\AttributesResourceMetadataCollectionFactory') + ->args([ + null, + service('logger')->nullOnInvalid(), + '%api_platform.defaults%', + '%api_platform.graphql.enabled%', + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.xml', 'ApiPlatform\Metadata\Resource\Factory\ExtractorResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 800) + ->args([ + service('api_platform.metadata.resource_extractor.xml'), + service('api_platform.metadata.resource.metadata_collection_factory.xml.inner'), + '%api_platform.defaults%', + service('logger')->nullOnInvalid(), + '%api_platform.graphql.enabled%', + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.php_file', 'ApiPlatform\Metadata\Resource\Factory\PhpFileResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 800) + ->args([ + service('api_platform.metadata.resource_extractor.php_file'), + service('api_platform.metadata.resource.metadata_collection_factory.php_file.inner'), + service('service_container')->nullOnInvalid(), + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.mutator', 'ApiPlatform\Metadata\Resource\Factory\MutatorResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 800) + ->args([ + service('api_platform.metadata.mutator_collection.resource'), + service('api_platform.metadata.mutator_collection.operation'), + service('api_platform.metadata.resource.metadata_collection_factory.mutator.inner'), + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.concerns', 'ApiPlatform\Metadata\Resource\Factory\ConcernsResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 800) + ->args([service('api_platform.metadata.resource.metadata_collection_factory.concerns.inner')]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.not_exposed_operation', 'ApiPlatform\Metadata\Resource\Factory\NotExposedOperationResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 700) + ->args([ + service('api_platform.metadata.resource.link_factory'), + service('api_platform.metadata.resource.metadata_collection_factory.not_exposed_operation.inner'), + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.backed_enum', 'ApiPlatform\Metadata\Resource\Factory\BackedEnumResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 500) + ->args([service('api_platform.metadata.resource.metadata_collection_factory.backed_enum.inner')]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.uri_template', 'ApiPlatform\Metadata\Resource\Factory\UriTemplateResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 500) + ->args([ + service('api_platform.metadata.resource.link_factory'), + service('api_platform.path_segment_name_generator'), + service('api_platform.metadata.resource.metadata_collection_factory.uri_template.inner'), + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.main_controller', 'ApiPlatform\Metadata\Resource\Factory\MainControllerResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 500) + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory.main_controller.inner'), + '%api_platform.use_symfony_listeners%', + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.link', 'ApiPlatform\Metadata\Resource\Factory\LinkResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 500) + ->args([ + service('api_platform.metadata.resource.link_factory'), + service('api_platform.metadata.resource.metadata_collection_factory.link.inner'), + '%api_platform.graphql.enabled%', + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.operation_name', 'ApiPlatform\Metadata\Resource\Factory\OperationNameResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 200) + ->args([service('api_platform.metadata.resource.metadata_collection_factory.operation_name.inner')]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.input_output', 'ApiPlatform\Metadata\Resource\Factory\InputOutputResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 200) + ->args([service('api_platform.metadata.resource.metadata_collection_factory.input_output.inner')]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.formats', 'ApiPlatform\Metadata\Resource\Factory\FormatsResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 200) + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory.formats.inner'), + '%api_platform.formats%', + '%api_platform.patch_formats%', + '%api_platform.error_formats%', + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.filters', 'ApiPlatform\Metadata\Resource\Factory\FiltersResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 200) + ->args([service('api_platform.metadata.resource.metadata_collection_factory.filters.inner')]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.alternate_uri', 'ApiPlatform\Metadata\Resource\Factory\AlternateUriResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 200) + ->args([service('api_platform.metadata.resource.metadata_collection_factory.alternate_uri.inner')]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.parameter', 'ApiPlatform\Metadata\Resource\Factory\ParameterResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 1000) + ->args([ + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.metadata.resource.metadata_collection_factory.parameter.inner'), + service('api_platform.filter_locator')->ignoreOnInvalid(), + service('api_platform.name_converter')->ignoreOnInvalid(), + service('logger')->ignoreOnInvalid(), + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.cached', 'ApiPlatform\Metadata\Resource\Factory\CachedResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, -10) + ->args([ + service('api_platform.cache.metadata.resource_collection'), + service('api_platform.metadata.resource.metadata_collection_factory.cached.inner'), + ]); + + $services->set('api_platform.cache.metadata.resource_collection') + ->parent('cache.system') + ->tag('cache.pool'); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/resource.xml b/src/Symfony/Bundle/Resources/config/metadata/resource.xml deleted file mode 100644 index a36de0c8331..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/resource.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - null - - %api_platform.defaults% - %api_platform.graphql.enabled% - - - - - - %api_platform.defaults% - - %api_platform.graphql.enabled% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.use_symfony_listeners% - - - - - - - %api_platform.graphql.enabled% - - - - - - - - - - - - - - %api_platform.formats% - %api_platform.patch_formats% - %api_platform.error_formats% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/resource_name.php b/src/Symfony/Bundle/Resources/config/metadata/resource_name.php new file mode 100644 index 00000000000..6605d2faa09 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/resource_name.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.cache.metadata.resource') + ->parent('cache.system') + ->tag('cache.pool'); + + $services->set('api_platform.metadata.resource.name_collection_factory.cached', 'ApiPlatform\Metadata\Resource\Factory\CachedResourceNameCollectionFactory') + ->decorate('api_platform.metadata.resource.name_collection_factory', null, -10) + ->args([ + service('api_platform.cache.metadata.resource'), + service('api_platform.metadata.resource.name_collection_factory.cached.inner'), + ]); + + $services->alias('api_platform.metadata.resource.name_collection_factory', 'api_platform.metadata.resource.name_collection_factory.xml'); + + $services->set('api_platform.metadata.resource.name_collection_factory.xml', 'ApiPlatform\Metadata\Resource\Factory\ExtractorResourceNameCollectionFactory') + ->args([service('api_platform.metadata.resource_extractor.xml')]); + + $services->set('api_platform.metadata.resource.name_collection_factory.php_file', 'ApiPlatform\Metadata\Resource\Factory\PhpFileResourceNameCollectionFactory') + ->decorate('api_platform.metadata.resource.name_collection_factory', null, 900) + ->args([ + service('api_platform.metadata.resource_extractor.php_file'), + service('api_platform.metadata.resource.name_collection_factory.php_file.inner'), + ]); + + $services->set('api_platform.metadata.resource.name_collection_factory.concerns', 'ApiPlatform\Metadata\Resource\Factory\ConcernsResourceNameCollectionFactory') + ->decorate('api_platform.metadata.resource.name_collection_factory', null, 800) + ->args([ + '%api_platform.resource_class_directories%', + service('api_platform.metadata.resource.name_collection_factory.concerns.inner'), + ]); + + $services->alias('ApiPlatform\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface', 'api_platform.metadata.resource.name_collection_factory'); + + $services->set('api_platform.metadata.resource.name_collection_factory.attributes', 'ApiPlatform\Metadata\Resource\Factory\AttributesResourceNameCollectionFactory') + ->decorate('api_platform.metadata.resource.name_collection_factory', null, 0) + ->args([ + '%api_platform.resource_class_directories%', + service('api_platform.metadata.resource.name_collection_factory.attributes.inner'), + ]); + + $services->set('api_platform.metadata.resource.name_collection_factory.class_name', 'ApiPlatform\Metadata\Resource\Factory\ClassNameResourceNameCollectionFactory') + ->decorate('api_platform.metadata.resource.name_collection_factory', null, 0) + ->args([ + '%api_platform.class_name_resources%', + service('api_platform.metadata.resource.name_collection_factory.class_name.inner'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/resource_name.xml b/src/Symfony/Bundle/Resources/config/metadata/resource_name.xml deleted file mode 100644 index 7cfc3132e64..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/resource_name.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.resource_class_directories% - - - - - - %api_platform.resource_class_directories% - - - - %api_platform.class_name_resources% - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/validator.php b/src/Symfony/Bundle/Resources/config/metadata/validator.php new file mode 100644 index 00000000000..6204d4bb036 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/validator.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.metadata.property.metadata_factory.validator', 'ApiPlatform\Symfony\Validator\Metadata\Property\ValidatorPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 20) + ->args([ + service('validator'), + service('api_platform.metadata.property.metadata_factory.validator.inner'), + tagged_iterator('api_platform.metadata.property_schema_restriction'), + ]); + + $services->set('api_platform.metadata.property_schema.choice_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaChoiceRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.collection_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaCollectionRestriction') + ->args([tagged_iterator('api_platform.metadata.property_schema_restriction')]) + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.count_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaCountRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.css_color_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaCssColorRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.greater_than_or_equal_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaGreaterThanOrEqualRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.greater_than_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaGreaterThanRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.length_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaLengthRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.less_than_or_equal_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaLessThanOrEqualRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.less_than_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaLessThanRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.one_of_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaOneOfRestriction') + ->args([tagged_iterator('api_platform.metadata.property_schema_restriction')]) + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.range_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaRangeRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.regex_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaRegexRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.format_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaFormat') + ->tag('api_platform.metadata.property_schema_restriction'); + + $services->set('api_platform.metadata.property_schema.unique_restriction', 'ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaUniqueRestriction') + ->tag('api_platform.metadata.property_schema_restriction'); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/validator.xml b/src/Symfony/Bundle/Resources/config/metadata/validator.xml deleted file mode 100644 index dad9b282a96..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/validator.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/xml.php b/src/Symfony/Bundle/Resources/config/metadata/xml.php new file mode 100644 index 00000000000..b66ba6cb6be --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/xml.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.metadata.resource_extractor.xml', 'ApiPlatform\Metadata\Extractor\XmlResourceExtractor') + ->args([ + [], + service('service_container'), + ]); + + $services->set('api_platform.metadata.property_extractor.xml', 'ApiPlatform\Metadata\Extractor\XmlPropertyExtractor') + ->args([ + [], + service('service_container'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/xml.xml b/src/Symfony/Bundle/Resources/config/metadata/xml.xml deleted file mode 100644 index 7c1a6a583ae..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/xml.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/metadata/yaml.php b/src/Symfony/Bundle/Resources/config/metadata/yaml.php new file mode 100644 index 00000000000..14025dd4582 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/metadata/yaml.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.metadata.resource_extractor.yaml', 'ApiPlatform\Metadata\Extractor\YamlResourceExtractor') + ->args([ + [], + service('service_container'), + ]); + + $services->set('api_platform.metadata.property_extractor.yaml', 'ApiPlatform\Metadata\Extractor\YamlPropertyExtractor') + ->args([ + [], + service('service_container'), + ]); + + $services->set('api_platform.metadata.resource.name_collection_factory.yaml', 'ApiPlatform\Metadata\Resource\Factory\ExtractorResourceNameCollectionFactory') + ->decorate('api_platform.metadata.resource.name_collection_factory', null, 0) + ->args([ + service('api_platform.metadata.resource_extractor.yaml'), + service('api_platform.metadata.resource.name_collection_factory.yaml.inner'), + ]); + + $services->set('api_platform.metadata.resource.metadata_collection_factory.yaml', 'ApiPlatform\Metadata\Resource\Factory\ExtractorResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 800) + ->args([ + service('api_platform.metadata.resource_extractor.yaml'), + service('api_platform.metadata.resource.metadata_collection_factory.yaml.inner'), + '%api_platform.defaults%', + service('logger')->nullOnInvalid(), + '%api_platform.graphql.enabled%', + ]); + + $services->set('api_platform.metadata.property.metadata_factory.yaml', 'ApiPlatform\Metadata\Property\Factory\ExtractorPropertyMetadataFactory') + ->decorate('api_platform.metadata.property.metadata_factory', null, 20) + ->args([ + service('api_platform.metadata.property_extractor.yaml'), + service('api_platform.metadata.property.metadata_factory.yaml.inner'), + ]); + + $services->set('api_platform.metadata.property.name_collection_factory.yaml', 'ApiPlatform\Metadata\Property\Factory\ExtractorPropertyNameCollectionFactory') + ->decorate('api_platform.metadata.property.name_collection_factory', null, 0) + ->args([ + service('api_platform.metadata.property_extractor.yaml'), + service('api_platform.metadata.property.name_collection_factory.yaml.inner'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/metadata/yaml.xml b/src/Symfony/Bundle/Resources/config/metadata/yaml.xml deleted file mode 100644 index ca494e63a8c..00000000000 --- a/src/Symfony/Bundle/Resources/config/metadata/yaml.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.defaults% - - %api_platform.graphql.enabled% - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/openapi.php b/src/Symfony/Bundle/Resources/config/openapi.php new file mode 100644 index 00000000000..01e38352f51 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/openapi.php @@ -0,0 +1,108 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.openapi.normalizer', 'ApiPlatform\OpenApi\Serializer\OpenApiNormalizer') + ->args([inline_service('Symfony\Component\Serializer\Serializer')->arg(0, [inline_service('Symfony\Component\Serializer\Normalizer\ObjectNormalizer')->arg(0, null)->arg(1, null)->arg(2, service('api_platform.property_accessor'))->arg(3, service('api_platform.property_info'))])->arg(1, [service('serializer.encoder.json')])]) + ->tag('serializer.normalizer', ['priority' => -795]); + + $services->alias('ApiPlatform\OpenApi\Serializer\OpenApiNormalizer', 'api_platform.openapi.normalizer'); + + $services->set('api_platform.openapi.provider', 'ApiPlatform\OpenApi\State\OpenApiProvider') + ->args([service('api_platform.openapi.factory')]) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'ApiPlatform\OpenApi\State\OpenApiProvider']) + ->tag('api_platform.state_provider', ['priority' => -100, 'key' => 'api_platform.openapi.provider']); + + $services->set('api_platform.openapi.serializer_context_builder', 'ApiPlatform\OpenApi\Serializer\SerializerContextBuilder') + ->decorate('api_platform.serializer.context_builder', null, 0) + ->args([service('api_platform.openapi.serializer_context_builder.inner')]); + + $services->set('api_platform.openapi.options', 'ApiPlatform\OpenApi\Options') + ->args([ + '%api_platform.title%', + '%api_platform.description%', + '%api_platform.version%', + '%api_platform.oauth.enabled%', + '%api_platform.oauth.type%', + '%api_platform.oauth.flow%', + '%api_platform.oauth.tokenUrl%', + '%api_platform.oauth.authorizationUrl%', + '%api_platform.oauth.refreshUrl%', + '%api_platform.oauth.scopes%', + '%api_platform.swagger.api_keys%', + '%api_platform.openapi.contact.name%', + '%api_platform.openapi.contact.url%', + '%api_platform.openapi.contact.email%', + '%api_platform.openapi.termsOfService%', + '%api_platform.openapi.license.name%', + '%api_platform.openapi.license.url%', + '%api_platform.openapi.overrideResponses%', + '%api_platform.swagger.persist_authorization%', + '%api_platform.swagger.http_auth%', + '%api_platform.openapi.tags%', + '%api_platform.openapi.errorResourceClass%', + '%api_platform.openapi.validationErrorResourceClass%', + '%api_platform.openapi.license.identifier%', + ]); + + $services->alias('ApiPlatform\OpenApi\Options', 'api_platform.openapi.options'); + + $services->set('api_platform.openapi.command', 'ApiPlatform\OpenApi\Command\OpenApiCommand') + ->args([ + service('api_platform.openapi.factory'), + service('api_platform.serializer'), + ]) + ->tag('console.command'); + + $services->set('api_platform.openapi.normalizer.api_gateway', 'ApiPlatform\OpenApi\Serializer\ApiGatewayNormalizer') + ->decorate('api_platform.openapi.normalizer', null, -1) + ->args([service('api_platform.openapi.normalizer.api_gateway.inner')]) + ->tag('serializer.normalizer'); + + $services->set('api_platform.openapi.normalizer.legacy', 'ApiPlatform\OpenApi\Serializer\LegacyOpenApiNormalizer') + ->decorate('api_platform.openapi.normalizer.api_gateway', null, -2) + ->args([service('api_platform.openapi.normalizer.legacy.inner')]) + ->tag('serializer.normalizer'); + + $services->alias('ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface', 'api_platform.openapi.factory'); + + $services->set('api_platform.openapi.factory', 'ApiPlatform\OpenApi\Factory\OpenApiFactory') + ->args([ + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.metadata.property.name_collection_factory'), + service('api_platform.metadata.property.metadata_factory'), + service('api_platform.json_schema.schema_factory'), + service('api_platform.filter_locator'), + '%api_platform.formats%', + service('api_platform.openapi.options'), + service('api_platform.pagination_options'), + service('api_platform.router'), + '%api_platform.error_formats%', + ]); + + $services->set('api_platform.cache.openapi') + ->parent('cache.system') + ->tag('cache.pool'); + + $services->set('api_platform.jsonopenapi.encoder', 'ApiPlatform\Serializer\JsonEncoder') + ->args([ + 'jsonopenapi', + service('serializer.json.encoder')->nullOnInvalid(), + ]) + ->tag('serializer.encoder'); +}; diff --git a/src/Symfony/Bundle/Resources/config/openapi.xml b/src/Symfony/Bundle/Resources/config/openapi.xml deleted file mode 100644 index 4e738bb4275..00000000000 --- a/src/Symfony/Bundle/Resources/config/openapi.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - null - null - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.title% - %api_platform.description% - %api_platform.version% - %api_platform.oauth.enabled% - %api_platform.oauth.type% - %api_platform.oauth.flow% - %api_platform.oauth.tokenUrl% - %api_platform.oauth.authorizationUrl% - %api_platform.oauth.refreshUrl% - %api_platform.oauth.scopes% - %api_platform.swagger.api_keys% - %api_platform.openapi.contact.name% - %api_platform.openapi.contact.url% - %api_platform.openapi.contact.email% - %api_platform.openapi.termsOfService% - %api_platform.openapi.license.name% - %api_platform.openapi.license.url% - %api_platform.openapi.overrideResponses% - %api_platform.swagger.persist_authorization% - %api_platform.swagger.http_auth% - %api_platform.openapi.tags% - %api_platform.openapi.errorResourceClass% - %api_platform.openapi.validationErrorResourceClass% - %api_platform.openapi.license.identifier% - - - - - - - - - - - - - - - - - - - - - - - - - - - - %api_platform.formats% - - - - %api_platform.error_formats% - - - - - - - - jsonopenapi - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/openapi/yaml.php b/src/Symfony/Bundle/Resources/config/openapi/yaml.php new file mode 100644 index 00000000000..cbe349700c5 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/openapi/yaml.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.yamlopenapi.encoder', 'ApiPlatform\Serializer\YamlEncoder') + ->args([ + 'yamlopenapi', + service('serializer.encoder.yaml')->nullOnInvalid(), + ]) + ->tag('serializer.encoder'); +}; diff --git a/src/Symfony/Bundle/Resources/config/openapi/yaml.xml b/src/Symfony/Bundle/Resources/config/openapi/yaml.xml deleted file mode 100644 index 4324d90ab37..00000000000 --- a/src/Symfony/Bundle/Resources/config/openapi/yaml.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - yamlopenapi - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/problem.php b/src/Symfony/Bundle/Resources/config/problem.php new file mode 100644 index 00000000000..493f8d446d5 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/problem.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.problem.encoder', 'ApiPlatform\Serializer\JsonEncoder') + ->args(['jsonproblem']) + ->tag('serializer.encoder'); + + $services->set('api_platform.problem.normalizer.validation_exception', 'ApiPlatform\Symfony\Validator\Serializer\ValidationExceptionNormalizer') + ->args([ + service('api_platform.serializer.normalizer.item'), + service('api_platform.name_converter')->ignoreOnInvalid(), + ]) + ->tag('serializer.normalizer', ['priority' => -800]); +}; diff --git a/src/Symfony/Bundle/Resources/config/problem.xml b/src/Symfony/Bundle/Resources/config/problem.xml deleted file mode 100644 index 724e7b37feb..00000000000 --- a/src/Symfony/Bundle/Resources/config/problem.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - jsonproblem - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/ramsey_uuid.php b/src/Symfony/Bundle/Resources/config/ramsey_uuid.php new file mode 100644 index 00000000000..0fd58364beb --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/ramsey_uuid.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.serializer.uuid_denormalizer', 'ApiPlatform\RamseyUuid\Serializer\UuidDenormalizer') + ->tag('serializer.normalizer'); + + $services->set('api_platform.ramsey_uuid.uri_variables.transformer.uuid', 'ApiPlatform\RamseyUuid\UriVariableTransformer\UuidUriVariableTransformer') + ->tag('api_platform.uri_variables.transformer', ['priority' => -100]); +}; diff --git a/src/Symfony/Bundle/Resources/config/ramsey_uuid.xml b/src/Symfony/Bundle/Resources/config/ramsey_uuid.xml deleted file mode 100644 index 5d179841c6e..00000000000 --- a/src/Symfony/Bundle/Resources/config/ramsey_uuid.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/security.php b/src/Symfony/Bundle/Resources/config/security.php new file mode 100644 index 00000000000..4ef0a24b76d --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/security.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->alias('api_platform.security.expression_language', 'security.expression_language'); + + $services->set('api_platform.security.resource_access_checker', 'ApiPlatform\Symfony\Security\ResourceAccessChecker') + ->args([ + service('api_platform.security.expression_language')->nullOnInvalid(), + service('security.authentication.trust_resolver')->nullOnInvalid(), + service('security.role_hierarchy')->nullOnInvalid(), + service('security.token_storage')->nullOnInvalid(), + service('security.authorization_checker')->nullOnInvalid(), + ]); + + $services->alias('ApiPlatform\Metadata\ResourceAccessCheckerInterface', 'api_platform.security.resource_access_checker'); + + $services->set('api_platform.security.expression_language_provider', 'ApiPlatform\Symfony\Security\Core\Authorization\ExpressionLanguageProvider') + ->tag('security.expression_language_provider'); +}; diff --git a/src/Symfony/Bundle/Resources/config/security.xml b/src/Symfony/Bundle/Resources/config/security.xml deleted file mode 100644 index c49185f25c6..00000000000 --- a/src/Symfony/Bundle/Resources/config/security.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/http_cache_purger.php b/src/Symfony/Bundle/Resources/config/state/http_cache_purger.php new file mode 100644 index 00000000000..1f165048db2 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/http_cache_purger.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.http_cache_purger.processor.add_tags', 'ApiPlatform\HttpCache\State\AddTagsProcessor') + ->decorate('api_platform.state_processor.respond', null, 0) + ->args([ + service('api_platform.http_cache_purger.processor.add_tags.inner'), + service('api_platform.iri_converter'), + service('api_platform.http_cache.purger')->nullOnInvalid(), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/http_cache_purger.xml b/src/Symfony/Bundle/Resources/config/state/http_cache_purger.xml deleted file mode 100644 index 487cd8625b2..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/http_cache_purger.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/hydra.php b/src/Symfony/Bundle/Resources/config/state/hydra.php new file mode 100644 index 00000000000..2e813796ee3 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/hydra.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.hydra.processor.link', 'ApiPlatform\Hydra\State\HydraLinkProcessor') + ->decorate('api_platform.state_processor.respond', null, 410) + ->args([ + service('api_platform.hydra.processor.link.inner'), + service('api_platform.router'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/hydra.xml b/src/Symfony/Bundle/Resources/config/state/hydra.xml deleted file mode 100644 index 0ccca8450ca..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/hydra.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/jsonapi.php b/src/Symfony/Bundle/Resources/config/state/jsonapi.php new file mode 100644 index 00000000000..54e24e0c897 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/jsonapi.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.jsonapi.state_provider', 'ApiPlatform\JsonApi\State\JsonApiProvider') + ->decorate('api_platform.state_provider.read', null, 0) + ->args([ + service('api_platform.jsonapi.state_provider.inner'), + '%api_platform.collection.order_parameter_name%', + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/jsonapi.xml b/src/Symfony/Bundle/Resources/config/state/jsonapi.xml deleted file mode 100644 index 66343fa4fdf..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/jsonapi.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - %api_platform.collection.order_parameter_name% - - - diff --git a/src/Symfony/Bundle/Resources/config/state/jsonld.php b/src/Symfony/Bundle/Resources/config/state/jsonld.php new file mode 100644 index 00000000000..820c348d9c8 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/jsonld.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.jsonld.action.context', 'ApiPlatform\JsonLd\Action\ContextAction') + ->public() + ->args([ + service('api_platform.jsonld.context_builder'), + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.state_provider.main')->nullOnInvalid(), + service('api_platform.state_processor.main')->nullOnInvalid(), + service('api_platform.serializer')->nullOnInvalid(), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/jsonld.xml b/src/Symfony/Bundle/Resources/config/state/jsonld.xml deleted file mode 100644 index 4343e4be4e3..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/jsonld.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/mercure.php b/src/Symfony/Bundle/Resources/config/state/mercure.php new file mode 100644 index 00000000000..d1bedad9f25 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/mercure.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.mercure.processor.add_link_header', 'ApiPlatform\Symfony\State\MercureLinkProcessor') + ->decorate('api_platform.state_processor.respond', null, 400) + ->args([ + service('api_platform.mercure.processor.add_link_header.inner'), + service('Symfony\Component\Mercure\Discovery')->ignoreOnInvalid(), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/mercure.xml b/src/Symfony/Bundle/Resources/config/state/mercure.xml deleted file mode 100644 index 605e3db069e..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/mercure.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/object_mapper.php b/src/Symfony/Bundle/Resources/config/state/object_mapper.php new file mode 100644 index 00000000000..6d04d07f21f --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/object_mapper.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.object_mapper.metadata_factory', 'Symfony\Component\ObjectMapper\Metadata\ReflectionObjectMapperMetadataFactory'); + + $services->set('api_platform.object_mapper', 'Symfony\Component\ObjectMapper\ObjectMapper') + ->args([ + service('api_platform.object_mapper.metadata_factory'), + service('property_accessor')->nullOnInvalid(), + tagged_locator('object_mapper.transform_callable'), + tagged_locator('object_mapper.condition_callable'), + ]); + + $services->set('api_platform.object_mapper.relation', 'ApiPlatform\State\ObjectMapper\ObjectMapper') + ->decorate('api_platform.object_mapper', null, -255) + ->args([service('api_platform.object_mapper.relation.inner')]); + + $services->set('api_platform.state_provider.object_mapper', 'ApiPlatform\State\Provider\ObjectMapperProvider') + ->decorate('api_platform.state_provider.locator', null, 0) + ->args([ + service('api_platform.object_mapper')->nullOnInvalid(), + service('api_platform.state_provider.object_mapper.inner'), + ]); + + $services->set('api_platform.state_processor.object_mapper', 'ApiPlatform\State\Processor\ObjectMapperProcessor') + ->decorate('api_platform.state_processor.locator', null, 0) + ->args([ + service('api_platform.object_mapper')->nullOnInvalid(), + service('api_platform.state_processor.object_mapper.inner'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/object_mapper.xml b/src/Symfony/Bundle/Resources/config/state/object_mapper.xml deleted file mode 100644 index b2cd35df627..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/object_mapper.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/parameter_provider.php b/src/Symfony/Bundle/Resources/config/state/parameter_provider.php new file mode 100644 index 00000000000..ae48061add5 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/parameter_provider.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_provider.parameter.iri_converter', 'ApiPlatform\State\ParameterProvider\IriConverterParameterProvider') + ->args([ + service('api_platform.iri_converter'), + service('logger')->ignoreOnInvalid(), + ]) + ->tag('api_platform.parameter_provider', ['key' => 'ApiPlatform\State\ParameterProvider\IriConverterParameterProvider', 'priority' => -895]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/parameter_provider.xml b/src/Symfony/Bundle/Resources/config/state/parameter_provider.xml deleted file mode 100644 index bb5c12e204b..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/parameter_provider.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/processor.php b/src/Symfony/Bundle/Resources/config/state/processor.php new file mode 100644 index 00000000000..ef45e6edd12 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/processor.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->alias('api_platform.state_processor.main', 'api_platform.state_processor.respond'); + + $services->set('api_platform.state_processor.serialize', 'ApiPlatform\State\Processor\SerializeProcessor') + ->decorate('api_platform.state_processor.main', null, 200) + ->args([ + service('api_platform.state_processor.serialize.inner'), + service('api_platform.serializer'), + service('api_platform.serializer.context_builder'), + ]); + + $services->set('api_platform.state_processor.write', 'ApiPlatform\State\Processor\WriteProcessor') + ->decorate('api_platform.state_processor.main', null, 100) + ->args([ + service('api_platform.state_processor.write.inner'), + service('api_platform.state_processor.locator'), + ]); + + $services->set('api_platform.state_processor.respond', 'ApiPlatform\State\Processor\RespondProcessor') + ->args([ + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.operation.metadata_factory'), + ]); + + $services->set('api_platform.state_processor.add_link_header', 'ApiPlatform\State\Processor\AddLinkHeaderProcessor') + ->decorate('api_platform.state_processor.respond', null, 0) + ->args([service('api_platform.state_processor.add_link_header.inner')]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/processor.xml b/src/Symfony/Bundle/Resources/config/state/processor.xml deleted file mode 100644 index 627d3742957..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/processor.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/provider.php b/src/Symfony/Bundle/Resources/config/state/provider.php new file mode 100644 index 00000000000..64863c93ea4 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/provider.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->alias('api_platform.state_provider.main', 'api_platform.state_provider.locator'); + + $services->set('api_platform.state_provider.content_negotiation', 'ApiPlatform\State\Provider\ContentNegotiationProvider') + ->decorate('api_platform.state_provider.main', null, 100) + ->args([ + service('api_platform.state_provider.content_negotiation.inner'), + service('api_platform.negotiator'), + '%api_platform.formats%', + '%api_platform.error_formats%', + ]); + + $services->set('api_platform.state_provider.read', 'ApiPlatform\State\Provider\ReadProvider') + ->decorate('api_platform.state_provider.main', null, 500) + ->args([ + service('api_platform.state_provider.read.inner'), + service('api_platform.serializer.context_builder'), + ]); + + $services->set('api_platform.state_provider.deserialize', 'ApiPlatform\State\Provider\DeserializeProvider') + ->decorate('api_platform.state_provider.main', null, 300) + ->args([ + service('api_platform.state_provider.deserialize.inner'), + service('api_platform.serializer'), + service('api_platform.serializer.context_builder'), + service('translator')->nullOnInvalid(), + ]); + + $services->set('api_platform.error_listener', 'ApiPlatform\Symfony\EventListener\ErrorListener') + ->arg('$controller', 'api_platform.symfony.main_controller') + ->arg('$logger', service('logger')->nullOnInvalid()) + ->arg('$debug', '%kernel.debug%') + ->arg('$exceptionsMapping', []) + ->arg('$resourceMetadataCollectionFactory', service('api_platform.metadata.resource.metadata_collection_factory')) + ->arg('$errorFormats', '%api_platform.error_formats%') + ->arg('$exceptionToStatus', '%api_platform.exception_to_status%') + ->arg('$identifiersExtractor', null) + ->arg('$resourceClassResolver', service('api_platform.resource_class_resolver')) + ->arg('$negotiator', service('api_platform.negotiator')); + + $services->set('api_platform.state_provider.parameter', 'ApiPlatform\State\Provider\ParameterProvider') + ->decorate('api_platform.state_provider.main', null, 180) + ->args([ + service('api_platform.state_provider.parameter.inner'), + tagged_locator('api_platform.parameter_provider', 'key'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/provider.xml b/src/Symfony/Bundle/Resources/config/state/provider.xml deleted file mode 100644 index 7a261fc7bbc..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/provider.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - %api_platform.formats% - %api_platform.error_formats% - - - - - - - - - - - - - - - - api_platform.symfony.main_controller - - %kernel.debug% - - - %api_platform.error_formats% - %api_platform.exception_to_status% - null - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/security.php b/src/Symfony/Bundle/Resources/config/state/security.php new file mode 100644 index 00000000000..a0f82cb10f5 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/security.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_provider.access_checker', 'ApiPlatform\Symfony\Security\State\AccessCheckerProvider') + ->decorate('api_platform.state_provider.read', null, 0) + ->args([ + service('api_platform.state_provider.access_checker.inner'), + service('api_platform.security.resource_access_checker'), + ]); + + $services->set('api_platform.state_provider.access_checker.post_deserialize', 'ApiPlatform\Symfony\Security\State\AccessCheckerProvider') + ->decorate('api_platform.state_provider.deserialize', null, 0) + ->args([ + service('api_platform.state_provider.access_checker.post_deserialize.inner'), + service('api_platform.security.resource_access_checker'), + 'post_denormalize', + ]); + + $services->set('api_platform.state_provider.security_parameter', 'ApiPlatform\State\Provider\SecurityParameterProvider') + ->decorate('api_platform.state_provider.access_checker', null, 0) + ->args([ + service('api_platform.state_provider.security_parameter.inner'), + service('api_platform.security.resource_access_checker'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/security.xml b/src/Symfony/Bundle/Resources/config/state/security.xml deleted file mode 100644 index e2f3492920e..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/security.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - post_denormalize - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/security_validator.php b/src/Symfony/Bundle/Resources/config/state/security_validator.php new file mode 100644 index 00000000000..d1725e83e93 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/security_validator.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_provider.access_checker.post_validate', 'ApiPlatform\Symfony\Security\State\AccessCheckerProvider') + ->decorate('api_platform.state_provider.validate', null, 0) + ->args([ + service('api_platform.state_provider.access_checker.post_validate.inner'), + service('api_platform.security.resource_access_checker'), + 'post_validate', + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/security_validator.xml b/src/Symfony/Bundle/Resources/config/state/security_validator.xml deleted file mode 100644 index 911b971c441..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/security_validator.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - post_validate - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/state.php b/src/Symfony/Bundle/Resources/config/state/state.php new file mode 100644 index 00000000000..7b1f71ba4b3 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/state.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_provider.locator', 'ApiPlatform\State\CallableProvider') + ->args([tagged_locator('api_platform.state_provider', 'key')]); + + $services->alias('api_platform.state_provider', 'api_platform.state_provider.locator'); + + $services->set('api_platform.state_processor.locator', 'ApiPlatform\State\CallableProcessor') + ->args([tagged_locator('api_platform.state_processor', 'key')]); + + $services->set('api_platform.pagination', 'ApiPlatform\State\Pagination\Pagination') + ->args([ + '%api_platform.collection.pagination%', + '%api_platform.graphql.collection.pagination%', + ]); + + $services->alias('ApiPlatform\State\Pagination\Pagination', 'api_platform.pagination'); + + $services->set('api_platform.serializer_locator', 'Symfony\Component\DependencyInjection\ServiceLocator') + ->args([['serializer' => service('api_platform.serializer')]]) + ->tag('container.service_locator'); + + $services->set('api_platform.pagination_options', 'ApiPlatform\State\Pagination\PaginationOptions') + ->args([ + '%api_platform.collection.pagination.enabled%', + '%api_platform.collection.pagination.page_parameter_name%', + '%api_platform.collection.pagination.client_items_per_page%', + '%api_platform.collection.pagination.items_per_page_parameter_name%', + '%api_platform.collection.pagination.client_enabled%', + '%api_platform.collection.pagination.enabled_parameter_name%', + '%api_platform.collection.pagination.items_per_page%', + '%api_platform.collection.pagination.maximum_items_per_page%', + '%api_platform.collection.pagination.partial%', + '%api_platform.collection.pagination.client_partial%', + '%api_platform.collection.pagination.partial_parameter_name%', + ]); + + $services->alias('ApiPlatform\State\Pagination\PaginationOptions', 'api_platform.pagination_options'); + + $services->set('api_platform.state_provider.create', 'ApiPlatform\State\CreateProvider') + ->args([ + service('api_platform.state_provider.locator'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('api_platform.state_provider', ['key' => 'ApiPlatform\State\CreateProvider']) + ->tag('api_platform.state_provider', ['key' => 'api_platform.state_provider.create']); + + $services->alias('ApiPlatform\State\CreateProvider', 'api_platform.state_provider.create'); + + $services->set('api_platform.state_provider.object', 'ApiPlatform\State\ObjectProvider') + ->tag('api_platform.state_provider', ['key' => 'ApiPlatform\State\ObjectProvider']) + ->tag('api_platform.state_provider', ['key' => 'api_platform.state_provider.object']); + + $services->alias('ApiPlatform\State\ObjectProvider', 'api_platform.state_provider.object'); + + $services->alias('ApiPlatform\State\SerializerContextBuilderInterface', 'api_platform.serializer.context_builder'); + + $services->set('api_platform.state_provider.backed_enum', 'ApiPlatform\State\Provider\BackedEnumProvider') + ->tag('api_platform.state_provider', ['key' => 'ApiPlatform\State\Provider\BackedEnumProvider']) + ->tag('api_platform.state_provider', ['key' => 'api_platform.state_provider.backed_enum']); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/state.xml b/src/Symfony/Bundle/Resources/config/state/state.xml deleted file mode 100644 index 694ed28ddce..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/state.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - %api_platform.collection.pagination% - %api_platform.graphql.collection.pagination% - - - - - - - - - - - %api_platform.collection.pagination.enabled% - %api_platform.collection.pagination.page_parameter_name% - %api_platform.collection.pagination.client_items_per_page% - %api_platform.collection.pagination.items_per_page_parameter_name% - %api_platform.collection.pagination.client_enabled% - %api_platform.collection.pagination.enabled_parameter_name% - %api_platform.collection.pagination.items_per_page% - %api_platform.collection.pagination.maximum_items_per_page% - %api_platform.collection.pagination.partial% - %api_platform.collection.pagination.client_partial% - %api_platform.collection.pagination.partial_parameter_name% - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/state/swagger_ui.php b/src/Symfony/Bundle/Resources/config/state/swagger_ui.php new file mode 100644 index 00000000000..74a18a231fb --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/state/swagger_ui.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.swagger_ui.provider', 'ApiPlatform\Symfony\Bundle\SwaggerUi\SwaggerUiProvider') + ->decorate('api_platform.state_provider.read', null, 0) + ->args([ + service('api_platform.swagger_ui.provider.inner'), + service('api_platform.openapi.factory'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/state/swagger_ui.xml b/src/Symfony/Bundle/Resources/config/state/swagger_ui.xml deleted file mode 100644 index 058c6da364c..00000000000 --- a/src/Symfony/Bundle/Resources/config/state/swagger_ui.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/swagger_ui.php b/src/Symfony/Bundle/Resources/config/swagger_ui.php new file mode 100644 index 00000000000..d32f460c39c --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/swagger_ui.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.swagger_ui.context', 'ApiPlatform\Symfony\Bundle\SwaggerUi\SwaggerUiContext') + ->args([ + '%api_platform.enable_swagger_ui%', + '%api_platform.show_webby%', + '%api_platform.enable_re_doc%', + '%api_platform.graphql.enabled%', + '%api_platform.graphql.graphiql.enabled%', + '%api_platform.asset_package%', + '%api_platform.swagger_ui.extra_configuration%', + ]); + + $services->set('api_platform.swagger_ui.processor', 'ApiPlatform\Symfony\Bundle\SwaggerUi\SwaggerUiProcessor') + ->args([ + service('twig')->nullOnInvalid(), + service('router'), + service('api_platform.serializer'), + service('api_platform.openapi.options'), + service('api_platform.swagger_ui.context'), + '%api_platform.docs_formats%', + '%api_platform.oauth.clientId%', + '%api_platform.oauth.clientSecret%', + '%api_platform.oauth.pkce%', + ]) + ->tag('api_platform.state_processor', ['priority' => -100, 'key' => 'api_platform.swagger_ui.processor']); +}; diff --git a/src/Symfony/Bundle/Resources/config/swagger_ui.xml b/src/Symfony/Bundle/Resources/config/swagger_ui.xml deleted file mode 100644 index 0cba5e812c1..00000000000 --- a/src/Symfony/Bundle/Resources/config/swagger_ui.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - %api_platform.enable_swagger_ui% - %api_platform.show_webby% - %api_platform.enable_re_doc% - %api_platform.graphql.enabled% - %api_platform.graphql.graphiql.enabled% - %api_platform.asset_package% - %api_platform.swagger_ui.extra_configuration% - - - - - - - - - %api_platform.docs_formats% - %api_platform.oauth.clientId% - %api_platform.oauth.clientSecret% - %api_platform.oauth.pkce% - - - - - diff --git a/src/Symfony/Bundle/Resources/config/symfony/controller.php b/src/Symfony/Bundle/Resources/config/symfony/controller.php new file mode 100644 index 00000000000..f0cb19075a2 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/symfony/controller.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.symfony.main_controller', 'ApiPlatform\Symfony\Controller\MainController') + ->public() + ->args([ + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.state_provider.main'), + service('api_platform.state_processor.main'), + service('api_platform.uri_variables.converter')->ignoreOnInvalid(), + service('logger')->ignoreOnInvalid(), + ]); + + $services->set('api_platform.action.entrypoint', 'ApiPlatform\Symfony\Action\EntrypointAction') + ->public() + ->args([ + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.state_provider.main'), + service('api_platform.state_processor.main'), + '%api_platform.docs_formats%', + ]); + + $services->set('api_platform.action.documentation', 'ApiPlatform\Symfony\Action\DocumentationAction') + ->public() + ->args([ + service('api_platform.metadata.resource.name_collection_factory'), + '%api_platform.title%', + '%api_platform.description%', + '%api_platform.version%', + service('api_platform.openapi.factory')->nullOnInvalid(), + service('api_platform.state_provider.main'), + service('api_platform.state_processor.main'), + service('api_platform.negotiator')->nullOnInvalid(), + '%api_platform.docs_formats%', + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/symfony/controller.xml b/src/Symfony/Bundle/Resources/config/symfony/controller.xml deleted file mode 100644 index d12617dd958..00000000000 --- a/src/Symfony/Bundle/Resources/config/symfony/controller.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - %api_platform.docs_formats% - - - - - %api_platform.title% - %api_platform.description% - %api_platform.version% - - - - - %api_platform.docs_formats% - - - diff --git a/src/Symfony/Bundle/Resources/config/symfony/events.php b/src/Symfony/Bundle/Resources/config/symfony/events.php new file mode 100644 index 00000000000..1f368138281 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/symfony/events.php @@ -0,0 +1,207 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_provider.content_negotiation', 'ApiPlatform\State\Provider\ContentNegotiationProvider') + ->args([ + null, + service('api_platform.negotiator'), + '%api_platform.formats%', + '%api_platform.error_formats%', + ]); + + $services->set('api_platform.listener.request.add_format', 'ApiPlatform\Symfony\EventListener\AddFormatListener') + ->args([ + service('api_platform.state_provider.content_negotiation'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.request', 'method' => 'onKernelRequest', 'priority' => 28]); + + $services->set('api_platform.state_provider.read', 'ApiPlatform\State\Provider\ReadProvider') + ->arg(0, service('api_platform.state_provider.locator')) + ->arg(1, service('api_platform.serializer.context_builder')) + ->arg('$logger', service('logger')->nullOnInvalid()); + + $services->set('api_platform.state_provider.parameter', 'ApiPlatform\State\Provider\ParameterProvider') + ->args([ + null, + tagged_locator('api_platform.parameter_provider', 'key'), + ]); + + $services->set('api_platform.listener.request.read', 'ApiPlatform\Symfony\EventListener\ReadListener') + ->args([ + service('api_platform.state_provider.read'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.uri_variables.converter'), + service('api_platform.state_provider.parameter')->nullOnInvalid(), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.request', 'method' => 'onKernelRequest', 'priority' => 4]); + + $services->set('api_platform.state_provider.deserialize', 'ApiPlatform\State\Provider\DeserializeProvider') + ->args([ + null, + service('api_platform.serializer'), + service('api_platform.serializer.context_builder'), + service('translator')->nullOnInvalid(), + ]); + + $services->set('api_platform.listener.request.deserialize', 'ApiPlatform\Symfony\EventListener\DeserializeListener') + ->args([ + service('api_platform.state_provider.deserialize'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.request', 'method' => 'onKernelRequest', 'priority' => 2]); + + $services->set('api_platform.state_processor.serialize', 'ApiPlatform\State\Processor\SerializeProcessor') + ->args([ + null, + service('api_platform.serializer'), + service('api_platform.serializer.context_builder'), + ]); + + $services->set('api_platform.state_processor.write', 'ApiPlatform\State\Processor\WriteProcessor') + ->args([ + null, + service('api_platform.state_processor.locator'), + ]); + + $services->set('api_platform.state_processor.respond', 'ApiPlatform\State\Processor\RespondProcessor') + ->args([ + service('api_platform.iri_converter'), + service('api_platform.resource_class_resolver'), + service('api_platform.metadata.operation.metadata_factory'), + ]); + + $services->set('api_platform.state_processor.add_link_header', 'ApiPlatform\State\Processor\AddLinkHeaderProcessor') + ->decorate('api_platform.state_processor.respond', null, 0) + ->args([service('api_platform.state_processor.add_link_header.inner')]); + + $services->set('api_platform.listener.view.write', 'ApiPlatform\Symfony\EventListener\WriteListener') + ->args([ + service('api_platform.state_processor.write'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.view', 'method' => 'onKernelView', 'priority' => 32]); + + $services->set('api_platform.listener.view.serialize', 'ApiPlatform\Symfony\EventListener\SerializeListener') + ->args([ + service('api_platform.state_processor.serialize'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.view', 'method' => 'onKernelView', 'priority' => 16]); + + $services->set('api_platform.listener.view.respond', 'ApiPlatform\Symfony\EventListener\RespondListener') + ->args([ + service('api_platform.state_processor.respond'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.view', 'method' => 'onKernelView', 'priority' => 8]); + + $services->set('api_platform.error_listener', 'ApiPlatform\Symfony\EventListener\ErrorListener') + ->arg('$controller', 'api_platform.action.placeholder') + ->arg('$logger', service('logger')->nullOnInvalid()) + ->arg('$debug', '%kernel.debug%') + ->arg('$exceptionsMapping', []) + ->arg('$resourceMetadataCollectionFactory', service('api_platform.metadata.resource.metadata_collection_factory')) + ->arg('$errorFormats', '%api_platform.error_formats%') + ->arg('$exceptionToStatus', '%api_platform.exception_to_status%') + ->arg('$identifiersExtractor', null) + ->arg('$resourceClassResolver', service('api_platform.resource_class_resolver')) + ->arg('$negotiator', service('api_platform.negotiator')); + + $services->alias('api_platform.state_processor.documentation', 'api_platform.state_processor.respond'); + + $services->set('api_platform.state_processor.documentation.serialize', 'ApiPlatform\State\Processor\SerializeProcessor') + ->decorate('api_platform.state_processor.documentation', null, 200) + ->args([ + service('api_platform.state_processor.documentation.serialize.inner'), + service('api_platform.serializer'), + service('api_platform.serializer.context_builder'), + ]); + + $services->set('api_platform.state_processor.documentation.write', 'ApiPlatform\State\Processor\WriteProcessor') + ->decorate('api_platform.state_processor.documentation', null, 100) + ->args([ + service('api_platform.state_processor.documentation.write.inner'), + service('api_platform.state_processor.locator'), + ]); + + $services->alias('api_platform.state_provider.documentation', 'api_platform.state_provider.locator'); + + $services->set('api_platform.state_provider.documentation.content_negotiation', 'ApiPlatform\State\Provider\ContentNegotiationProvider') + ->decorate('api_platform.state_provider.documentation', null, 100) + ->args([ + service('api_platform.state_provider.documentation.content_negotiation.inner'), + service('api_platform.negotiator'), + '%api_platform.formats%', + '%api_platform.error_formats%', + ]); + + $services->set('api_platform.state_provider.documentation.read', 'ApiPlatform\State\Provider\ReadProvider') + ->decorate('api_platform.state_provider.documentation', null, 500) + ->args([ + service('api_platform.state_provider.documentation.read.inner'), + service('api_platform.serializer.context_builder'), + ]); + + $services->set('api_platform.action.entrypoint', 'ApiPlatform\Symfony\Action\EntrypointAction') + ->public() + ->args([ + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.state_provider.documentation'), + service('api_platform.state_processor.documentation'), + '%api_platform.docs_formats%', + ]); + + $services->set('api_platform.action.documentation', 'ApiPlatform\Symfony\Action\DocumentationAction') + ->public() + ->args([ + service('api_platform.metadata.resource.name_collection_factory'), + '%api_platform.title%', + '%api_platform.description%', + '%api_platform.version%', + service('api_platform.openapi.factory')->nullOnInvalid(), + service('api_platform.state_provider.documentation'), + service('api_platform.state_processor.documentation'), + service('api_platform.negotiator')->nullOnInvalid(), + '%api_platform.docs_formats%', + ]); + + $services->set('api_platform.action.placeholder', 'ApiPlatform\Symfony\Action\PlaceholderAction') + ->public(); + + $services->alias('ApiPlatform\Symfony\Action\PlaceholderAction', 'api_platform.action.placeholder') + ->public(); + + $services->alias('api_platform.action.get_collection', 'api_platform.action.placeholder') + ->public(); + + $services->alias('api_platform.action.post_collection', 'api_platform.action.placeholder') + ->public(); + + $services->alias('api_platform.action.get_item', 'api_platform.action.placeholder') + ->public(); + + $services->alias('api_platform.action.patch_item', 'api_platform.action.placeholder') + ->public(); + + $services->alias('api_platform.action.put_item', 'api_platform.action.placeholder') + ->public(); + + $services->alias('api_platform.action.delete_item', 'api_platform.action.placeholder') + ->public(); +}; diff --git a/src/Symfony/Bundle/Resources/config/symfony/events.xml b/src/Symfony/Bundle/Resources/config/symfony/events.xml deleted file mode 100644 index a28184af50a..00000000000 --- a/src/Symfony/Bundle/Resources/config/symfony/events.xml +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - null - - %api_platform.formats% - %api_platform.error_formats% - - - - - - - - - - - - - - - - - null - - - - - - - - - - - - - - - null - - - - - - - - - - - - - null - - - - - - null - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - api_platform.action.placeholder - - %kernel.debug% - - - %api_platform.error_formats% - %api_platform.exception_to_status% - null - - - - - - - - - - - - - - - - - - - - - - - %api_platform.formats% - %api_platform.error_formats% - - - - - - - - - - - - %api_platform.docs_formats% - - - - - %api_platform.title% - %api_platform.description% - %api_platform.version% - - - - - %api_platform.docs_formats% - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/symfony/jsonld.php b/src/Symfony/Bundle/Resources/config/symfony/jsonld.php new file mode 100644 index 00000000000..bdbbf477343 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/symfony/jsonld.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.jsonld.action.context', 'ApiPlatform\JsonLd\Action\ContextAction') + ->public() + ->args([ + service('api_platform.jsonld.context_builder'), + service('api_platform.metadata.resource.name_collection_factory'), + service('api_platform.metadata.resource.metadata_collection_factory'), + service('api_platform.state_provider.documentation')->nullOnInvalid(), + service('api_platform.state_processor.documentation')->nullOnInvalid(), + service('api_platform.serializer')->nullOnInvalid(), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/symfony/jsonld.xml b/src/Symfony/Bundle/Resources/config/symfony/jsonld.xml deleted file mode 100644 index f6b4b59b5c6..00000000000 --- a/src/Symfony/Bundle/Resources/config/symfony/jsonld.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/symfony/swagger_ui.php b/src/Symfony/Bundle/Resources/config/symfony/swagger_ui.php new file mode 100644 index 00000000000..fbe44dbfd8d --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/symfony/swagger_ui.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.swagger_ui.documentation.provider', 'ApiPlatform\Symfony\Bundle\SwaggerUi\SwaggerUiProvider') + ->decorate('api_platform.state_provider.documentation.read', null, 0) + ->args([ + service('api_platform.swagger_ui.documentation.provider.inner'), + service('api_platform.openapi.factory'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/symfony/swagger_ui.xml b/src/Symfony/Bundle/Resources/config/symfony/swagger_ui.xml deleted file mode 100644 index 7b3a1346186..00000000000 --- a/src/Symfony/Bundle/Resources/config/symfony/swagger_ui.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/symfony/symfony.php b/src/Symfony/Bundle/Resources/config/symfony/symfony.php new file mode 100644 index 00000000000..7514ec145ab --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/symfony/symfony.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.listener.exception', 'ApiPlatform\Symfony\EventListener\ExceptionListener') + ->args([ + service('api_platform.error_listener')->nullOnInvalid(), + '%api_platform.handle_symfony_errors%', + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.exception', 'method' => 'onKernelException', 'priority' => -96]) + ->tag('monolog.logger', ['channel' => 'request']); + + $services->set('api_platform.cache_warmer.cache_pool_clearer', 'ApiPlatform\Symfony\Bundle\CacheWarmer\CachePoolClearerCacheWarmer') + ->args([ + service('cache.system_clearer'), + ['api_platform.cache.metadata.property', 'api_platform.cache.metadata.resource', 'api_platform.cache.metadata.resource_collection', 'api_platform.cache.route_name_resolver', 'api_platform.cache.identifiers_extractor', 'api_platform.elasticsearch.cache.metadata.document'], + ]) + ->tag('kernel.cache_warmer', ['priority' => 64]); +}; diff --git a/src/Symfony/Bundle/Resources/config/symfony/symfony.xml b/src/Symfony/Bundle/Resources/config/symfony/symfony.xml deleted file mode 100644 index f16daef8574..00000000000 --- a/src/Symfony/Bundle/Resources/config/symfony/symfony.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - %api_platform.handle_symfony_errors% - - - - - - - - - api_platform.cache.metadata.property - api_platform.cache.metadata.resource - api_platform.cache.metadata.resource_collection - api_platform.cache.route_name_resolver - api_platform.cache.identifiers_extractor - api_platform.elasticsearch.cache.metadata.document - - - - - diff --git a/src/Symfony/Bundle/Resources/config/symfony/uid.php b/src/Symfony/Bundle/Resources/config/symfony/uid.php new file mode 100644 index 00000000000..04fe8eeeca6 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/symfony/uid.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.symfony.uri_variables.transformer.ulid', 'ApiPlatform\Symfony\UriVariableTransformer\UlidUriVariableTransformer') + ->tag('api_platform.uri_variables.transformer'); + + $services->set('api_platform.symfony.uri_variables.transformer.uuid', 'ApiPlatform\Symfony\UriVariableTransformer\UuidUriVariableTransformer') + ->tag('api_platform.uri_variables.transformer'); +}; diff --git a/src/Symfony/Bundle/Resources/config/symfony/uid.xml b/src/Symfony/Bundle/Resources/config/symfony/uid.xml deleted file mode 100644 index f230f5ea99c..00000000000 --- a/src/Symfony/Bundle/Resources/config/symfony/uid.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/validator/events.php b/src/Symfony/Bundle/Resources/config/validator/events.php new file mode 100644 index 00000000000..d190c79e49f --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/validator/events.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_provider.validate', 'ApiPlatform\Symfony\Validator\State\ValidateProvider') + ->args([ + null, + service('api_platform.validator'), + ]); + + $services->set('api_platform.listener.view.validate', 'ApiPlatform\Symfony\EventListener\ValidateListener') + ->args([ + service('api_platform.state_provider.validate'), + service('api_platform.metadata.resource.metadata_collection_factory'), + ]) + ->tag('kernel.event_listener', ['event' => 'kernel.view', 'method' => 'onKernelView', 'priority' => 64]); + + $services->set('api_platform.state_provider.parameter_validator', 'ApiPlatform\Symfony\Validator\State\ParameterValidatorProvider') + ->public() + ->decorate('api_platform.state_provider.read', null, 110) + ->args([ + service('validator'), + service('api_platform.state_provider.parameter_validator.inner'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/validator/events.xml b/src/Symfony/Bundle/Resources/config/validator/events.xml deleted file mode 100644 index 449538eb37f..00000000000 --- a/src/Symfony/Bundle/Resources/config/validator/events.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - null - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/validator/state.php b/src/Symfony/Bundle/Resources/config/validator/state.php new file mode 100644 index 00000000000..6c9ff400bb7 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/validator/state.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.state_provider.validate', 'ApiPlatform\Symfony\Validator\State\ValidateProvider') + ->decorate('api_platform.state_provider.main', null, 200) + ->args([ + service('api_platform.state_provider.validate.inner'), + service('api_platform.validator'), + ]); + + $services->set('api_platform.state_provider.parameter_validator', 'ApiPlatform\Symfony\Validator\State\ParameterValidatorProvider') + ->public() + ->decorate('api_platform.state_provider.main', null, 191) + ->args([ + service('validator'), + service('api_platform.state_provider.parameter_validator.inner'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/validator/state.xml b/src/Symfony/Bundle/Resources/config/validator/state.xml deleted file mode 100644 index 77e5b7db1a5..00000000000 --- a/src/Symfony/Bundle/Resources/config/validator/state.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Bundle/Resources/config/validator/validator.php b/src/Symfony/Bundle/Resources/config/validator/validator.php new file mode 100644 index 00000000000..ec3280d2a93 --- /dev/null +++ b/src/Symfony/Bundle/Resources/config/validator/validator.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +return function (ContainerConfigurator $container) { + $services = $container->services(); + + $services->set('api_platform.validator', 'ApiPlatform\Symfony\Validator\Validator') + ->args([ + service('validator'), + tagged_locator('api_platform.validation_groups_generator'), + ]); + + $services->alias('ApiPlatform\Validator\ValidatorInterface', 'api_platform.validator'); + + $services->set('api_platform.validator.state.error_provider', 'ApiPlatform\Symfony\Validator\State\ErrorProvider') + ->tag('api_platform.state_provider', ['key' => 'api_platform.validator.state.error_provider']); + + $services->set('api_platform.validator.metadata.resource.metadata_collection_factory.parameter', 'ApiPlatform\Validator\Metadata\Resource\Factory\ParameterValidationResourceMetadataCollectionFactory') + ->decorate('api_platform.metadata.resource.metadata_collection_factory', null, 1000) + ->args([ + service('api_platform.validator.metadata.resource.metadata_collection_factory.parameter.inner'), + service('api_platform.filter_locator'), + ]); +}; diff --git a/src/Symfony/Bundle/Resources/config/validator/validator.xml b/src/Symfony/Bundle/Resources/config/validator/validator.xml deleted file mode 100644 index e22897eaf21..00000000000 --- a/src/Symfony/Bundle/Resources/config/validator/validator.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -