protected function paginate($qb, $pageOpts, $filters = array())
    {
        $db = $this->db;

        $total = count($db->fetchAll($qb->getSQL(), $filters));

        if (isset($pageOpts['start'])) {
            $qb->setFirstResult(isset($pageOpts['start']) ? $pageOpts['start'] : 0)
                ->setMaxResults(isset($pageOpts['limit']) ? $pageOpts['limit'] : 200);
        }

        $result = $db->fetchAll($qb->getSQL(), $filters);

        return array(
            'total' => $total,
            'results' => $result
        );
    }
protected function paginate($qb, $pageOpts, $filters = array())
    {
        $db = $this->db;

        $total = count($db->fetchAll($qb->getSQL(), $filters));

        if (isset($pageOpts['start'])) {
            $qb->setFirstResult(isset($pageOpts['start']) ? $pageOpts['start'] : 0)
                ->setMaxResults(isset($pageOpts['limit']) ? $pageOpts['limit'] : 200);
        }

        $result = $db->fetchAll($qb->getSQL(), $filters);

        return array(
            'total' => $total,
            'results' => $result
        );
    }
protected function paginate ( $ qb , $ pageOpts , $ filters = array ( ) ) { $ db = $ this -> db ; $ total = count ( $ db -> fetchAll ( $ qb -> getSQL ( ) , $ filters ) ) ; if ( isset ( $ pageOpts [ 'start' ] ) ) { $ qb -> setFirstResult ( isset ( $ pageOpts [ 'start' ] ) ? $ pageOpts [ 'start' ] : 0 ) -> setMaxResults ( isset ( $ pageOpts [ 'limit' ] ) ? $ pageOpts [ 'limit' ] : 200 ) ; } $ result = $ db -> fetchAll ( $ qb -> getSQL ( ) , $ filters ) ; return array ( 'total' => $ total , 'results' => $ result ) ; }
Pagina o resultado de uma consulta.

@param QueryBuilder $qb
@param array        $pageOpts
@param array        $filters

@return array
Pagina o resultado de uma consulta .