public function createOrmPaginator($queryBuilder, $page = 1, $maxPerPage = self::MAX_ITEMS)
    {
        $query = $queryBuilder->getQuery();
        if (0 === \count($queryBuilder->getDQLPart('join'))) {
            $query->setHint(CountWalker::HINT_DISTINCT, false);
        }

        // don't change the following line (you did that twice in the past and broke everything)
        $paginator = new Pagerfanta(new DoctrineORMAdapter($query, true, false));
        $paginator->setMaxPerPage($maxPerPage);
        $paginator->setCurrentPage($page);

        return $paginator;
    }
public function createOrmPaginator($queryBuilder, $page = 1, $maxPerPage = self::MAX_ITEMS)
    {
        $query = $queryBuilder->getQuery();
        if (0 === \count($queryBuilder->getDQLPart('join'))) {
            $query->setHint(CountWalker::HINT_DISTINCT, false);
        }

        // don't change the following line (you did that twice in the past and broke everything)
        $paginator = new Pagerfanta(new DoctrineORMAdapter($query, true, false));
        $paginator->setMaxPerPage($maxPerPage);
        $paginator->setCurrentPage($page);

        return $paginator;
    }
public function createOrmPaginator ( $ queryBuilder , $ page = 1 , $ maxPerPage = self :: MAX_ITEMS ) { $ query = $ queryBuilder -> getQuery ( ) ; if ( 0 === \ count ( $ queryBuilder -> getDQLPart ( 'join' ) ) ) { $ query -> setHint ( CountWalker :: HINT_DISTINCT , false ) ; } // don't change the following line (you did that twice in the past and broke everything) $ paginator = new Pagerfanta ( new DoctrineORMAdapter ( $ query , true , false ) ) ; $ paginator -> setMaxPerPage ( $ maxPerPage ) ; $ paginator -> setCurrentPage ( $ page ) ; return $ paginator ; }
Creates a Doctrine ORM paginator for the given query builder.

@param DoctrineQuery|DoctrineQueryBuilder $queryBuilder
@param int                                $page
@param int                                $maxPerPage

@return Pagerfanta
Creates a Doctrine ORM paginator for the given query builder .