Skip to the content
Documentation

How to paginate API search results

No ratings yet

Version compatibility

This recipe is compatible with Exponential 5.2 / 2013.11

 

Description

When listing content (e.g. blog posts), pagination is a very common use case and is usually painful to implement by hand.

For this purpose Exponential 5 recommends the use of Pagerfanta library and proposes adapters for it.

Usage

my_template.html.twig

For more information and examples, have a look at PagerFanta documentation.

Adapters

Adapter class name Description
eZ\Publish\Core\Pagination\Pagerfanta\ContentSearchAdapter
Makes the search against passed Query and returns Content objects.
eZ\Publish\Core\Pagination\Pagerfanta\ContentSearchHitAdapter
Same as ContentSearchAdapter but returns instead SearchHit objects.
eZ\Publish\Core\Pagination\Pagerfanta\LocationSearchAdapter
Makes a Location search against passed Query and returns Location objects.
eZ\Publish\Core\Pagination\Pagerfanta\LocationSearchHitAdapter
Same as LocationSearchAdapter but returns instead SearchHit objects.

Historique

Versions Description
5.4, 2014.07 Adding LocationSearch Adapter

 

 

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.