php – Pagination using numbers instead of cursor-ThrowExceptions

Exception or error:

I’m using Symfony 5 with the latest version of api-platform. Running PHP 7.3.

I’m using the graphql api and trying to achieve a number based pagination.
In the current documentation only cursor based pagination is explained. OR is there a way to paginate like [1][2][3][4][5] based on the cursor? AFAIK not.

I’ve also read the ApiPlatform\Core\DataProvider\Pagination class and looked into the getOffset and getLimit functions. So I tried in my query to pass numeric values but it resulted in “Cursor 0 is invalid”.

The query:

`before: "0", after: "10"`
query SearchOrders($first: Int!) {
  orders(first: $first, before: "1", after: "10") {
How to solve:

You need to use the master version of API Platform (or to wait for the new release).
The page-based pagination has been added in it.

See for the documentation.

Leave a Reply

Your email address will not be published. Required fields are marked *