Skip to content

fix pagination defaults and add tests#4011

Merged
soyuka merged 2 commits into
api-platform:2.6from
GrimpEreau:fix/issue-3992
Feb 3, 2021
Merged

fix pagination defaults and add tests#4011
soyuka merged 2 commits into
api-platform:2.6from
GrimpEreau:fix/issue-3992

Conversation

@GrimpEreau

Copy link
Copy Markdown
Contributor
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tickets fixes #3992
License MIT
Doc PR n/a

Comment thread src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php Outdated
@soyuka soyuka added this to the 2.6.2 milestone Feb 2, 2021
$container->setParameter('api_platform.collection.order', $config['defaults']['order'] ?? $config['collection']['order']);
$container->setParameter('api_platform.collection.order_parameter_name', $config['collection']['order_parameter_name']);
$container->setParameter('api_platform.collection.pagination.enabled', $this->isConfigEnabled($container, $config['defaults']['pagination_enabled'] ?? $config['collection']['pagination']));
$container->setParameter('api_platform.collection.pagination.enabled', $config['api_platform']['defaults'] ?? $this->isConfigEnabled($container, $config['collection']['pagination']));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$container->setParameter('api_platform.collection.pagination.enabled', $config['api_platform']['defaults'] ?? $this->isConfigEnabled($container, $config['collection']['pagination']));
$container->setParameter('api_platform.collection.pagination.enabled', $config['api_platform']['defaults']['pagination_enabled'] ?? $this->isConfigEnabled($container, $config['collection']['pagination']));

'attributes' => [
'pagination' => true,
],
];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be:

 $config['api_platform']['defaults'] = [
            'pagination_enabled' => true
        ];

@GrimpEreau GrimpEreau changed the base branch from main to 2.6 February 3, 2021 12:15
@soyuka soyuka merged commit d65b136 into api-platform:2.6 Feb 3, 2021
@soyuka

soyuka commented Feb 3, 2021

Copy link
Copy Markdown
Member

thanks @GrimpEreau !

cacahouwete pushed a commit to cacahouwete/core that referenced this pull request Feb 8, 2021
* fix pagination defaults and add tests

* fix typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug when using defaults.pagination_enabled to configure pagination

3 participants