From 4da7df7d8f732137d6a7ada5ea638429eff7c39e Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Wed, 16 Nov 2022 15:13:31 +0100 Subject: [PATCH] api-platform: enable the client pagination config Mainly so it renders the relevant pagination parameters into the openapi and api docs. We handle the parameters manually in all cases. Instead of "itemsPerPage" we default to "perPage", for historic reasons. --- src/DependencyInjection/DbpRelayCoreExtension.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/DependencyInjection/DbpRelayCoreExtension.php b/src/DependencyInjection/DbpRelayCoreExtension.php index ac9bcd9..cd51b7f 100644 --- a/src/DependencyInjection/DbpRelayCoreExtension.php +++ b/src/DependencyInjection/DbpRelayCoreExtension.php @@ -60,6 +60,15 @@ class DbpRelayCoreExtension extends ConfigurableExtension implements PrependExte $container->prependExtensionConfig('api_platform', [ 'title' => $config['docs_title'], + 'collection' => [ + 'pagination' => [ + // This enables it for the doctrine integration, which we don't actually use. + // But it also adds it to the open-api docs which need because we implement it manually + // in the controllers and providers, so enable it anyway. + 'client_items_per_page' => true, + 'items_per_page_parameter_name' => 'perPage', + ], + ], 'description' => $config['docs_description'], 'defaults' => [ 'cache_headers' => [ -- GitLab