rudra/rudra-paginaton-bundle

Paginator bundle for Symfony2 to automate pagination and simplify sorting and other features

dev-master 2017-08-20 18:27 UTC

This package is auto-updated.

Last update: 2024-10-12 20:44:17 UTC


README

SensioLabsInsight

RudraPaginatonBundle

Add PaginatorBundle to your application kernel

// app/AppKernel.php

public function registerBundles()
{
    return array(
        // ...
        new Rudra\PaginationBundle\RudraPaginationBundle(),
        // ...
    );
}

Configuration example

You can configure default query parameter names and templates

rudra_pagination:
    per_page: 1                      # default page range used in pagination control

In Controller

$pagination = $this->get('rudra_pagination');
$pagination->init($id);
$pagination->setCount($this->getDoctrine()->getRepository(Blog::class)->numRows($conn));
$blogData = $this->getDoctrine()->getRepository(Blog::class)->getDataPerPage($conn, $pagination);

return $this->render('some/blog.html.twig', [
        ...
        'links' => $pagination->getLinks(),
        ...
    ]
);