/**
  * Retorna o itens da paginação
  *
  * @param int $iInicioPaginacao
  * @param int $iItensPorPagina
  * @return array
  */
 public function getItems($iInicioPaginacao, $iItensPorPagina)
 {
     $this->_query->setFirstResult($iInicioPaginacao);
     $this->_query->setMaxResults($iItensPorPagina);
     $aResultado = $this->_query->getQuery()->getResult();
     $aRetorno = array();
     foreach ($aResultado as $sModelo) {
         $aRetorno[] = new $this->_modelName($sModelo);
     }
     return $aRetorno;
 }
 public function getItems($offset, $itemCountPerPage)
 {
     $this->_query->setFirstResult($offset);
     $this->_query->setMaxResults($itemCountPerPage);
     $a = $this->_query->getQuery()->getResult();
     $r = array();
     foreach ($a as $i) {
         $r[] = new $this->_modelName($i);
     }
     return $r;
 }
示例#3
0
 /**
  * Returns items matching the given criteria
  *
  * @param  int $offset Page offset
  * @param  int $itemCountPerPage Number of items per page
  * @return array
  */
 public function getItems($offset, $itemCountPerPage)
 {
     if ($offset > 0) {
         $this->query->setFirstResult($offset);
     }
     $this->query->setMaxResults($itemCountPerPage);
     return $this->query->select('e')->getQuery()->getResult();
 }
示例#4
0
 /**
  * Set the page with paginate attribute.
  *
  * @param int $page
  * @param int $limit
  *
  * @return $this
  */
 public function paginate($limit = 25, $page = 0)
 {
     if ($limit > 0) {
         $this->queryBuilder->setMaxResults($limit);
     }
     if ($page > 0) {
         $this->queryBuilder->setFirstResult($page * $limit);
     }
     return $this;
 }
 /**
  * Returns the whole aggregated feed. You can limit the list giving any number.
  *
  * @return List<UnifiedSocialEntityInterface>
  */
 public function getFeed($limit = false, $offset = false)
 {
     if ($limit !== false && is_int($limit)) {
         $this->qb->setMaxResults($limit);
     }
     if ($offset !== false && is_int($offset)) {
         $this->qb->setFirstResult($offset);
     }
     $this->qb->andWhere('e.approved = 1');
     return $this->qb->getQuery()->getResult();
 }
示例#6
0
 /**
  * Sets offset and limit.
  * @param int $offset
  * @param int $limit
  */
 public function limit($offset, $limit)
 {
     $this->qb->setFirstResult($offset)->setMaxResults($limit);
 }