facile-it / paginator-bundle
lightweight symfony2 pagination
Installs: 4 559
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 45
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- doctrine/orm: ^2.2.3
- symfony/framework-bundle: ^2.0 | ^3.0 | ^4.0
- twig/twig: ^1.5 | ^2.0
Requires (Dev)
- phpunit/phpunit: ^4.7 | ^5.0
- satooshi/php-coveralls: ~1.0
This package is not auto-updated.
Last update: 2023-06-04 08:46:24 UTC
README
A lightweight symfony2 pagination system
Requirements:
- Twig
>=1.5
version is required if you plan to include the twig template. - Twig
2.*
is allowed
Features:
- Inizialization can be made via request or via setters
- Handle route as well as route parameters
Installation and configuration:
Quite easy Composer, add:
{ "require": { "facile-it/paginator-bundle": "dev-master" } }
Or if you want to clone the repos:
git clone git://github.com/facile-it/paginator-bundle.git vendor/facile-it/PaginatorBundle
Add PaginatorBundle to your application kernel
// app/AppKernel.php public function registerBundles() { return array( // ... new Facile\PaginatorBundle\FacilePaginatorBundle(), // ... ); }
Usage examples:
Controller
Currently paginator can paginate:
Doctrine\ORM\QueryBuilder
// Acme\MainBundle\Controller\ProductController.php $queryBuilder = $this ->get('doctrine.orm.entity_manager') ->getRepository('AcmeMainBundle:Product') ->createQueryBuilder('product') $paginator = $this->get('facile.paginator')->parseRequest($this->getRequest()); return $this->render('AcmeMainBundle:Product:list.html.twig', array( 'results' => $pagination, 'paginationInfo' => $paginator->getPaginationInfo($filterBuilder ) );
View
{# display results #} <table> {% for product in results %} <tr > <td>{{ product.id }}</td> <td>{{ product.title }}</td> </tr> {% endfor %} </table> {# display navigation #} <div class="navigation"> {% include 'FacilePaginatorBundle:Pagination:template.html.twig' %} </div>