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);
    }
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);
    }
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 ) ; }
Returns paginated results
@param Paginator $paginator
@param array $params
@return mixed
Returns paginated results