, (*1)
RudraPaginatonBundle
Add PaginatorBundle to your application kernel, (*2)
// app/AppKernel.php, (*3)
public function registerBundles()
{
return array(
// ...
new Rudra\PaginationBundle\RudraPaginationBundle(),
// ...
);
}
Configuration example, (*4)
You can configure default query parameter names and templates, (*5)
rudra_pagination:
per_page: 1 # default page range used in pagination control
In Controller, (*6)
$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(),
...
]
);