Get paginator

@param   mixed|null  $where
@param   mixed|null  $order
@param   mixed|null  $columns
@param   mixed|null  $joins
@param   mixed|null  $quantifier
@return  \Zend\Paginator\Paginator
3355
public function getPaginator( $where        = null,
                                  $order        = null,
                                  $columns      = null,
                                  $joins        = null,
                                  $quantifier   = null )
    {
        $joins = array_merge( (array) $joins, array(
            'user_group' => array(
                'table'     => $this->getTableInSchema( 'user_group' ),
                'where'     => 'user.groupId = user_group.id',
                'columns'   => array(
                    'groupName' => 'name',
                ),
            ),
        ) );

        return parent::getPaginator( $where, $order, $columns, $joins, $quantifier );
    }
1312722
public function scopePaginateFilter($query, $perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $perPage = $perPage ?: config('eloquentfilter.paginate_limit');
        $paginator = $query->paginate($perPage, $columns, $pageName, $page);
        $paginator->appends($this->filtered);

        return $paginator;
    }
135591
public static function paginate(JsonApiSerializer $serializer, Builder $builder, $pageSize = null)
    {
        self::sort($serializer, $builder, $builder->getModel());

        $request = RequestFactory::create();

        $builder->paginate(
            $request->getPage()->size() ?: $pageSize,
            self::columns($serializer, $request->getFields()->get()),
            'page',
            $request->getPage()->number()
        );

        return $builder;
    }
217536
protected function groupedPaginate($paginator, $perPage, $columns)
	{
		$results = $this->get($columns);

		return $this->buildRawPaginator($paginator, $results, $perPage);
	}
585095
public function paginate($limit = null, $columns = ['*'], $method = "paginate")
    {
        return parent::paginate(
            $limit,
            $this->getColumnsNames($columns),
            $method
        );
    }
912573
public function selectAllPaginate(
        $first = 0,
        $max = 20,
        array $filters = [],
        array $orderBy = [],
        array $groupBy = [],
        $fetchJoinCollection = true
    ) {
        $selection = $this->getEntityManager()->createQueryBuilder();

        $selection->select([$this->entityAlias])
            ->from($this->entityClass, $this->entityAlias);

        $selection = $this->filterFurther($filters, $orderBy, $groupBy, $selection, $first, $max);

        return new Paginator($selection, $fetchJoinCollection);
    }
878029
function find(array $where = null, $order = null, $limit = 0, $offset = 0, $lock = null) {
		$query = $this->getQueryWriter()->reset();
		$query->write("SELECT * FROM", $this->conn->quoteName($this->name));
		if ($where) {
			$query->write("WHERE")->criteria($where);
		}
		if ($order) {
			$query->write("ORDER BY", $order);
		}
		if ($limit) {
			$query->write("LIMIT", $limit);
		}
		if ($offset) {
			$query->write("OFFSET", $offset);
		}
		if ($lock) {
			$query->write("FOR", $lock);
		}
		return $this->execute($query);
	}
632897
public static function pages($order_by = '', $where = null, $limit = 50, $offset = 0) {
        $module = \jacmoe\mdpages\Module::getInstance();
        if(!is_null($module)) {
            $controller = \Yii::$app->controller;
            if(!is_null($controller)) {
                if($controller->id == 'page') {
                    $repo = $controller->getFlywheelRepo();
                    if(empty($order_by)) {
                        if(isset($where)) {
                            list($field, $operator, $value) = $where;
                            return $repo->query()->limit($limit, $offset)->where($field, $operator, $value)->execute();
                        } else {
                            return $repo->query()->limit($limit, $offset)->execute();
                        }
                    } else {
                        if(isset($where)) {
                            list($field, $operator, $value) = $where;
                            return $repo->query()->limit($limit, $offset)->where($field, $operator, $value)->orderBy($order_by)->execute();
                        } else {
                            return $repo->query()->limit($limit, $offset)->orderBy($order_by)->execute();
                        }
                    }
                }
                throw new NotSupportedException("Can only be used when active controller is 'page'.");
            }
        }
        throw new NotSupportedException("Can't be called outside of jacmoe\mdpages module.");
    }
1034415
public function findOne( $where = null, $order = null )
    {
        foreach ( $this->findIterator( $where, $order ) as $structure )
        {
            if ( $structure )
            {
                return $structure;
            }
        }

        return null;
    }
1074277
public function simplePaginate($perPage = null, $columns = ['*'])
    {
        $page = Paginator::resolveCurrentPage();

        $perPage = $perPage ?: $this->entityMap->getPerPage();

        $this->skip(($page - 1) * $perPage)->take($perPage + 1);

        return new Paginator($this->get($columns)->all(), $perPage, $page, ['path' => Paginator::resolveCurrentPath()]);
    }
140992
public function getPaginator( $where        = null,
                                  $order        = null,
                                  $columns      = null,
                                  $joins        = null,
                                  $quantifier   = null )
    {
        $joins = array_merge( (array) $joins, array(
            'rootParagraph' => array(
                'table'     => array(
                    'rootParagraph' => $this->getTableInSchema( 'paragraph' )
                ),
                'where'     => 'customize_rule.rootParagraphId = rootParagraph.id',
                'type'      => Sql\Select::JOIN_LEFT,
                'columns'   => array(
                    'rootType'  => 'type',
                    'rootName'  => 'name',
                ),
            ),
        ) );

        return parent::getPaginator( $where, $order, $columns, $joins, $quantifier );
    }
118687
public function where(array $parameters, string $field = null, string $order = null)
    {
        $query = $this->model->with($this->with)->where($parameters);
        if ($order) {
            $query->orderBy($field, $order);
        }
        $response = $query->get();
        $this->with = [];
        return $response;
    }
648698
public function getPaginator($params = array()) 
	{
		$page = isset($params['page']) ? (int)$params['page'] : 1;
		$email = isset($params['email']) ? $params['email'] : null;
		$limit = isset($params['limit']) ? (int) $params['limit'] : 10;
		$offset = isset($params['offset']) ? (int) $params['offset'] : 0;
		
		
		$qb = $this->_em->createQueryBuilder();
		$qb->select(array('a'));
		$qb->from($this->getEntityName(), 'a');
		$qb->addOrderBy('a.dateInsert', 'DESC');
		
		if(null !== $email) {
			$qb->andWhere($qb->expr()->eq('a.email', ':paramEmail'));
			$qb->setParameter('paramEmail', $email);
		}
		
		$query = $qb->getQuery();
		$query->setFirstResult($offset);
		$query->setMaxResults($limit);
// 		$paginator = new DoctrinePaginator($query, $fetchJoinCollection = true);
// 		$result = array();
// 		foreach($paginator as $p) {
// 			$result[] = $p->getUserId();
// 		}
// 		$result = $query->getResult();
// 		$paginatorAdapter =  new RazorPaginator(
// 			$result,
// 			count($paginator)
// 		);
		$paginatorAdapter = new DoctrinePaginatorAdapter(new DoctrinePaginator($query));
		$paginator = new Paginator($paginatorAdapter);
		$paginator->setCurrentPageNumber($page);
		$paginator->setDefaultItemCountPerPage($limit);
		
		return $paginator;
	}
69542
public function getFromWhere($from, $where=NULL, $where_values=array(), $order=NULL, $limit=NULL, $offset=NULL){
        $res= FALSE;
        try{
            //Armo partes de la consulta
            if($order != NULL){$order= " ORDER BY " . $order;}
            if($limit != NULL){
                $limit= " LIMIT " . $limit;
                if($offset != NULL){$limit.= ' OFFSET ' . $offset;}
            }
            //Armo y preparo la consulta
            $query= $this->prepareSelect($this->select, $from, $where, '', '', $order, $limit);
            //Ejecuto la consulta
            $query->execute($where_values);
            //Controlo que este todo bien
            if($this->isOk($query)){
                $res= $query;
            }
            //Limpio las variables del AR
            $this->cleanVars();
        } catch (\PDOException $e) {
            $this->cleanVars();
            throw $e;
        }
        return $res;
    }
1307992
public function getByPage(
        int $page = 1,
        int $limit = 10,
        array $where = [],
        array $with = [],
        string $orderBy = null,
        string $order = 'desc'
    ) {
        $query = $this->make($with);

        $query = $this->applyWhere($query, $where);

        if ($orderBy) {
            $query = $query->orderBy($orderBy, $order);
        }

        return $query->skip($limit * ($page - 1))
            ->take($limit)
            ->get();
    }
34260
protected function findIterator( $where = null, $order = null )
    {
        $names = $this->queryNames( $where );

        if ( null !== $order && '' !== $order )
        {
            sort( $names, SORT_NATURAL );

            if ( ! $order )
            {
                $names = array_reverse( $names );
            }
        }

        return new StructureList( $this, $names );
    }
676275
public function findPaginated(
        $entityClass,
        array $criteria,
        $sorting = [],
        $offset = Request\Params::DEFAULT_PAGE_OFFSET,
        $limit = Request\Params::DEFAULT_PAGE_SIZE,
        $translatable = false
    )
    {
        $qb = $this->getQueryBuilder($entityClass, $criteria, $sorting, $translatable);
        
        $qb->setFirstResult($offset)
            ->setMaxResults($limit);

        $paginator = new Paginator($qb->getQuery());
        $collection = new PaginatedCollection($paginator);

        return $collection;
    }