Core: Pagination params in Url break response(with client config enabled)

Created on 9 Apr 2019  路  6Comments  路  Source: api-platform/core

Looks like refactoring of PaginationExtension broke pagination params in url
https://github.com/api-platform/core/commit/89c0f30d188b0ff4f15302d1ee901353417663e3#diff-b6c1bf23325d339d3b93944061c72aad

I have this config

api_platform:
    collection:
        pagination:
            client_items_per_page: true
            client_enabled: true

my test request shows "hydra:totalItems": 40 and correct links to other pages,
though when I add ?pagination=false it says "hydra:totalItems": 25.
I would expect it to be 40 with all items in one request.

itemsPerPage parameter has no effect at all.

v2.3.6 works as expected for both params.

bug waiting

Most helpful comment

Is this on a subresource operation? If yes, see #2717

You couldn't reproduce? We may need a little bit more informations if that's possible @desmax ?

All 6 comments

Is this on a subresource operation? If yes, see #2717

@teohhanhui both. That pull request is unrelated.

Is this on a subresource operation? If yes, see #2717

You couldn't reproduce? We may need a little bit more informations if that's possible @desmax ?

Yes, I haven't been able to reproduce the problem, even after fixing the relevant Behat tests (WIP: https://github.com/api-platform/core/pull/2723).

@desmax Perhaps if you could help add a failing Behat test to our test suite, that'd be awesome.

@teohhanhui @soyuka Ok guys, I finally found where the bug is. Kind of from my side but I also think this is not right. I decorate api_platform.doctrine.orm.query_extension.pagination and PaginationExtension class in method applyToCollection has a parameter $context which is not described in QueryCollectionExtensionInterface. So I just missed it in my decorator.
I am closing this issue, but maybe the interface should be updated.

@desmax It's in ContextAwareQueryCollectionExtensionInterface, which PaginationExtension implements: https://github.com/api-platform/core/blob/v2.4.3/src/Bridge/Doctrine/Orm/Extension/ContextAwareQueryCollectionExtensionInterface.php

We cannot change an existing interface for BC reasons.

Was this page helpful?
0 / 5 - 0 ratings