Entity/EntityRepository.php
protected function addPagination(QueryBuilder $queryBuilder, $elementsPerPage, $page = 1)
    {
        $elementsPerPage = (int)$elementsPerPage;
        $page = (int)$page;

        return $queryBuilder
            ->setMaxResults($elementsPerPage)
            ->setFirstResult($elementsPerPage * ($page - 1));
    }
protected function addPagination(QueryBuilder $queryBuilder, $elementsPerPage, $page = 1)
    {
        $elementsPerPage = (int)$elementsPerPage;
        $page = (int)$page;

        return $queryBuilder
            ->setMaxResults($elementsPerPage)
            ->setFirstResult($elementsPerPage * ($page - 1));
    }
protected function addPagination ( QueryBuilder $ queryBuilder , $ elementsPerPage , $ page = 1 ) { $ elementsPerPage = ( int ) $ elementsPerPage ; $ page = ( int ) $ page ; return $ queryBuilder -> setMaxResults ( $ elementsPerPage ) -> setFirstResult ( $ elementsPerPage * ( $ page - 1 ) ) ; }
Adds pagination to the specified query builder.

@param \Doctrine\ORM\QueryBuilder $queryBuilder
@param integer $elementsPerPage
@param integer $page
@return \Doctrine\ORM\QueryBuilder
Adds pagination to the specified query builder .