1
我想實現分頁,使用最新版本的教義: https://doctrine-orm.readthedocs.org/en/latest/tutorials/pagination.html?highlight=doctrine%20dql%20pagination分頁教義2,ZF2
$query = $this->getEntityManager()->createQuery('
SELECT b,pb
FROM BookApi\Entity\Book b
LEFT JOIN b.publisher pb
')->setFirstResult(0)->setMaxResults(10);
$paginator = new Paginator($query, $fetchJoinCollection = true);
$this->totalResults = count($paginator);
的計數我得到與分頁程序返回的是正確的。 但是,getQuery不會給我十個結果。它返回5.
$output = $paginator->getQuery()->getArrayResult();
這是錯誤的方法?
@ocramius展示瞭如何在這裏做在他的學說/ ZF2教程(值得一讀本身) - > http://marco-pivetta.com/doctrine-orm -zf2教程/#/ 32 – Crisp