我会立刻说,我读了这个问题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 );
Run Code Online (Sandbox Code Playgroud)
这很棒.
现在,当使用Doctrine2时,我很困惑我应该如何获得与当前页面的有限结果相同的查询的总记录数量.
任何帮助/建议将不胜感激.