如何在Symfony 2中有效地使用分歧与教义? [英] How can I use efficiently paginate with doctrine in Symfony 2?
问题描述
这个包与我发现的其他类似。它需要查询构建器作为参数。有没有更好的方式来做到这一点,而不是将每个存储库函数作为一个参数(或null)的分页符?我不想分页每个查询结果,所以我不认为所描述的解决方案是最好的,我正在寻找sugestions。
我知道两个软件包:
- https://github.com/KnpLabs/KnpPaginatorBundle
- https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle
两者都可以分页ORM / Query或ORM / QueryBuilder(等等)。
I would like to use Doctrine ORM and a pagination method in Symfony. KnpPaginatorBundle looks simple and easy to use. I also use Doctrine repositories because the queries can be easily reused and tested.
This bundle works like others I found. It needs the query builder as parameter. Is there a better way to do this than giving each repository function the paginator as a parameter (or null)? I do not want to paginate every query result so I do not think that the described solution is the best and I am looking for sugestions.
I know two bundles for doing that:
- https://github.com/KnpLabs/KnpPaginatorBundle
- https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle
Both can paginate ORM/Query or ORM/QueryBuilder (and more).
这篇关于如何在Symfony 2中有效地使用分歧与教义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!