Download the PHP package lucasgiori/doctrine-pagination without Composer
On this page you can find all versions of the php package lucasgiori/doctrine-pagination. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package doctrine-pagination
This library provides a paginated repository and collection for Doctrine.
Installation
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
Configure Repository
Use it as Entity repository
Configure PaginatedRepository in your entity:
Create your custom Paginated repository
Create custom repository extending PaginatedRepository:
Configure your Entity:
If needed, override processCriteria method in your custom repository to add some custom actions:
Parameter DTO to facilitate data searches:
Class that performs the search of data consuming DTO and return PaginatedArrayCollention;
Using Paginated Repository
public findPageBy ($page, $per_page, array $criteria = [], array $orderBy = null)
Returns a paginated collection of elements that matches criteria.
public countBy (array $criteria = [])
Returns the total number of elements that matches criteria.
protected createPaginatedQueryBuilder (array $criteria = [], $indexBy = null)
This method is used by findPageBy and countBy methods to create a QueryBuilder, and can be used in other repository custom methods.
processCriteria (protected)
This method is called from createPaginatedQueryBuilder to add criteria conditions.
This can be overridden to customize those criteria conditions.
findBy and findAll
PaginatedRepository overrides findBy and findAll default Doctrine Repository methods to provides code compatibility.
Using Paginated Collections
The PaginatedRepository always returns a PaginatedArrayCollection:
count()
getTotal()
getPage()
getResultsPerPage()
getPages()
getNextPage()
getPrevPage()