rudra / rudra-paginaton-bundle
Symfony2的分页器组件,用于自动化分页、简化排序和其他功能
dev-master
2017-08-20 18:27 UTC
Requires
- php: >=5.3.3
- symfony/framework-bundle: ~2.7|~3.0
Requires (Dev)
- phpunit/phpunit: ~4.8
- symfony/expression-language: ~2.7|~3.0
This package is auto-updated.
Last update: 2024-09-12 20:29:05 UTC
README
RudraPaginatonBundle
将PaginatorBundle添加到您的应用内核
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Rudra\PaginationBundle\RudraPaginationBundle(),
// ...
);
}
配置示例
您可以为默认查询参数名称和模板进行配置
rudra_pagination:
per_page: 1 # default page range used in pagination control
在控制器中
$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(),
...
]
);