Doctrine 2.2 pagination

http://docs.doctrine-project.org/en/latest/tutorials/pagination.html


createQuery($dql)
->setFirstResult(0)
->setMaxResults(100);

$paginator = new Paginator($query, $fetchJoinCollection = true);

$c = count($paginator);
foreach ($paginator as $post) {
echo $post->getHeadline() . "\n";
}

Leave a Reply