马上我会说,我读了这个问题Doctrine2 Paginator,但它没有给我足够的信息关于我的问题的标题。Doctrine2 Paginator获得总体结果
当我用Doctrine1我正在与例如这样的代码的结果:
$list = $this->query
->addSelect('SQL_CALC_FOUND_ROWS *')
->offset(($this->currentPage - 1) * $this->perPage)
->limit($this->perPage)
->execute(array(), \Doctrine_Core::HYDRATE_ARRAY_SHALLOW);
$totalRecords = SqlCalcFoundRowsEventListener::getFoundRowsCount();
$this->totalPages = ceil($totalRecords/$this->perPage);
,它是伟大的。
现在,当使用Doctrine2我很困惑我该如何获得与当前页面的限制结果相同的查询记录总量。
任何帮助/建议将不胜感激。
最终会回答明天 - 现在请HTTPS检查的分页程序测试:// github上。 com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/ORM/Functional/PaginationTest.php – Ocramius 2013-04-09 21:46:15
查看测试,但没有测试,在将查询传递给paginator之前设置了限制。也许我误解了一些东西。 – Eugene 2013-04-09 22:33:44