Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for API Platform pagination. #12

Open
b00gizm opened this issue Jan 20, 2023 · 0 comments
Open

Add support for API Platform pagination. #12

b00gizm opened this issue Jan 20, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@b00gizm
Copy link
Contributor

b00gizm commented Jan 20, 2023

Since 2.7 API Platform supports custom pagination aka pagination for custom state providers.

If you are using custom state providers (not the provided Doctrine ORM, ODM or ElasticSearch ones) and if you want your results to be paginated, you will need to return an instance of a ApiPlatform\State\Pagination\PartialPaginatorInterface or ApiPlatform\State\Pagination\PaginatorInterface. A few existing classes are provided to make it easier to paginate the results:

ApiPlatform\State\Pagination\ArrayPaginator
ApiPlatform\State\Pagination\TraversablePaginator

Their definition is slightly different from the Paginator contract defined in geekcell/php-ddd, which probably calls for an adapter.

Since this is an optional feature and not all users might use API Platform and/or are already on 2.7 or higher, we should accommodate for this fact and avoid conflicts. Here's an example of how Symfony dealt with these kind of situations in the past.

@b00gizm b00gizm added enhancement New feature or request good first issue Good for newcomers labels Jan 20, 2023
@janvt janvt self-assigned this Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants