Download the PHP package arturdoruch/paginator-bundle without Composer
On this page you can find all versions of the php package arturdoruch/paginator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arturdoruch/paginator-bundle
More information about arturdoruch/paginator-bundle
Files in arturdoruch/paginator-bundle
Package paginator-bundle
Short Description Simple paginator for Symfony2
License MIT
Informations about the package paginator-bundle
PaginatorBundle
Simple paginator for Symfony2, which can paginate:
- array
- Doctrine\ORM\Query
- Doctrine\ORM\QueryBuilder
- Doctrine\ODM\MongoDB\Query\Builder
- Doctrine\ODM\MongoDB\Query\Query
- Doctrine\MongoDB\CursorInterface
- MongoCursor
Installation
Add the following line to your composer.json require block
and run composer command
or simply
Register ArturDoruchPaginatorBundle in your application kernel class
Configuration
Usage
Controller
Get paginator in controller method.
Paginate items list.
ArturDoruch\PaginatorBundle\Paginator::paginate() method receive three parameters:
- $query (mixed) A Doctrine ORM query or query builder, Doctrine mongodb ODM query or query builder, instance of Doctrine\MongoDB\CursorInterface, instance of MongoCursor, or array with arrays of items.
- $page (integer) Number of page to display
- $limit (integer) The number of items per page. Possible values are:
- -1 - fetch all items (limit will be omitted)
- 0 - default limit (setting in config "artur_doruch_paginator.limit") will be used
- integer positive - given $limit value will be used
Examples
Paginate items with Doctrine ORM query and query builder.
Paginate items with Doctrine ODM MongoDB query and query builder.
Paginate items with Doctrine\MongoDB\CursorInterface and MongoCursor.
Paginate items from array. Array can contain array or object collection.
View
In twig template you can use several functions to display all paginate list data. Each of them require Pagination class instance as parameter. See example below.
All versions of paginator-bundle with dependencies
symfony/framework-bundle Version >2.0
doctrine/orm Version ^2.2.3
twig/extensions Version ~1.0