Get Results paginated.

@param  integer $start
@param  integer $limit

@return Doctrine\ORM\Tools\Pagination\Paginator
503919
public function paginate($start, $limit, $fetchJoinCollection = true)
    {
        $this->setFirstResult($start)
             ->setMaxResults($limit);

        return new Paginator($this, $fetchJoinCollection);
    }
1209611
public function getPaginated($limit = 1, $fields = null, $sqlQuery = false)
    {
        $sql = $this->buildQuery('select', $fields, ['count'=>null, 'field'=>'num']);
        $result = $this->executeQuery($sql);
        $row = $result->fetch_array(MYSQLI_ASSOC);
        $total = $row['num'];
        if($total == 0 && $sqlQuery == false) {
            return [];
        }
        $this->pagination->initialize($limit, $total);
        return $this->limit($limit, $this->pagination->getStartPoint())->getAll($fields, $sqlQuery);
    }
476680
public function getPaginated($page = 1, $limit = 10)
    {
        $query = $this->make();
        $collection = $query->forPage($page, $limit)->get();
        return new PaginatedResult($page, $limit, $collection->count(), $collection);
    }
114925
public function paginate(Paginator $paginator, $params = [])
    {
        $query = $this->paramsToQuery($params);

        $countQuery = $this->getDB()->newSelect();
        $countQuery->count(['*', 'count']);
        $countQuery->from([$query, 'tbl']);
        $results = $countQuery->execute()->fetchResults();
        $count = $results[0]['count'];

        $paginator->setCount($count);

        $params['limit'] = $paginator->getLimits();

        return $this->findByParams($params);
    }
213056
public function limit($limit) : QueryBuilder
    {
        $this->_query[] = "LIMIT";

        if(is_array($limit)) {
            $this->_query[] = $this->getQuoted($limit[0]).",";
            $this->_query[] = $this->getQuoted($limit[1]);

            return $this;
        }

        $this->_query[] = $this->getQuoted($limit);

        return $this;
    }
1299414
public function pagination($page, $limit, $query = null, $orderBy = null, $sort = 'ASC', $filter = null)
    {
        return $this->getMapper()->pagination($page, $limit, $query, $orderBy, $sort, $filter);
    }
216990
public function findLimited($limit = 0)
    {
        $queryBuilder = $this->createQueryBuilder('c')
            ->where('c.enabled = :enabled')
            ->orderBy('c.position')
            ->setParameters(array(
                'enabled' => true,
            ));

        if ($limit != 0) {
            $queryBuilder->setMaxResults($limit);
        }

        return $queryBuilder->getQuery()->getResult();
    }
1316488
public function getUrlRange($start, $end)
    {
        return collect(range($start, $end))->mapWithKeys(function ($page) {
            return [$page => $this->url($page)];
        })->all();
    }
1284559
public function findAll($start, $limit, $sortBy, $sortOrder = 'ASC', $params)
    {
        $query = count($params) ? $this->createFilterQuery($params) : new Query();
        $query->setFrom($start);

        // Sort & order
        $fieldName = (isset($sortBy['fieldName'])) ? $sortBy['fieldName'] : null;

        if ($fieldName !== null && $fieldName !== $this->modelIdentifier) {

            if (isset($this->fieldsMapping[$fieldName])) {
                $fieldName = $this->fieldsMapping[$fieldName];
            }
            $query->setSort(array($fieldName => array('order' => strtolower($sortOrder))));
        } else {
            $query->setSort(array(
                $this->modelIdentifier => array('order' => strtolower($sortOrder)),
            ));
        }

        // Custom filter for admin
        if(method_exists($this->admin, 'getExtraFilter')) {
            $query->setFilter($this->admin->getExtraFilter());
        }

        // Limit
        if ($limit === null) {
            $limit = 10000; // set to 0 does not seem to work
        }

        return $this->finder->find($query, $limit);
    }
167734
public function paginate($limit = 25, $page = 0)
    {
        if ($limit > 0) {
            $this->queryBuilder->setMaxResults($limit);
        }

        if ($page > 0) {
            $this->queryBuilder->setFirstResult($page * $limit);
        }

        return $this;
    }
542005
public function getPagedResults($limit = 25, $page = 0)
    {
        $template = self::DQL_ALL;
        $dql = sprintf($template, UserPermission::class, User::class);

        return $this->getPaginator($dql, $limit, $page, []);
    }
738650
public function paginate($limit = 25, $current = null)
    {
        $page = $this->getCurrentPage($current);

        $from = $limit * ($page - 1);
        $size = $limit;

        $result = $this->from($from)->size($size)->get();

        return new PlasticPaginator($result, $size, $page);
    }
961718
public function dataLoader($page, $limit)
    {
        if ($limit > 0) {
            $this->getQueryBuilder()->setMaxResults($limit);
            $this->getQueryBuilder()->setFirstResult(($page - 1) * $limit);
        }

        $paginator = new Paginator($this->getQueryBuilder());
        $tableData = new SimpleTableData();
        $tableData->setTotalResults(count($paginator));
        $tableData->setResults(iterator_to_array($paginator->getIterator()));

        return $tableData;
    }
872599
public function limit($length, $start = null)
    {
        return new ModelResult($this->model_class, array_slice($this->models, $start, $length));
    }
1061567
public function findWhere(array $conditions, $limit = null)
    {
        $result = $this->db
            ->from($this->collection)
            ->getWhere($conditions, $limit);

        if ($result->count() > 0) {
            $this->result = new DataObjects\Result($result, $this);

            if ($limit == 1) {
                return $this->result->first();
            }

            return $this->result;
        }

        return false;
    }
39045
public function paginate(int $limit = 20, int $offset = 0, ?callable $totalQuery = null)
    {
        $this->rowsLimit = $limit;

        $this->rowsOffset = $offset;

        $records = $this->limit($limit)->offset($offset)->fetchAll();

        $this->setPristineRecords($records);

        if ($totalQuery) {
            $query = $this->newSelectQuery();

            call_user_func_array($totalQuery, [$query]);
        } else {
            $query = clone $this->getSelectQuery();

            $query->clearLimit();
            $query->clearOffset();
        }
        [$sql, $params] = $query->clearColumns()->count()->toSql();

        $this->rowsTotal = $this->connection()->sqlFetchColumn($sql, $params);

        return $this;
    }
791159
public function limit($limit = null, $offset = null)
    {
        $this->results = $this->fetch($limit, $offset);

        return $this->results->fetchAll();
    }