paginate() public method

Pagination wraper to get()
public paginate ( string $table, integer $page, array | string $fields = null ) : array
$table string The name of the database table to work with
$page integer Page number
$fields array | string Array or coma separated list of fields to fetch
return array
Ejemplo n.º 1
0
 /**
  * Pagination wraper to get()
  *
  * @access public
  * @param int $page Page number
  * @param array|string $fields Array or coma separated list of fields to fetch
  * @return array
  */
 private function paginate($page, $fields = null)
 {
     $this->db->pageLimit = self::$pageLimit;
     $res = $this->db->paginate($this->dbTable, $page, $fields);
     self::$totalPages = $this->db->totalPages;
     return $res;
 }
Ejemplo n.º 2
0
 /**
  * Pagination wraper to get()
  *
  * @access public
  * @param int $page Page number
  * @param array|string $fields Array or coma separated list of fields to fetch
  * @return array
  */
 private function paginate($page, $fields = null)
 {
     $this->db->pageLimit = self::$pageLimit;
     $res = $this->db->paginate($this->dbTable, $page, $fields);
     self::$totalPages = $this->db->totalPages;
     if ($this->db->count == 0) {
         return null;
     }
     foreach ($res as &$r) {
         $this->processArrays($r);
         $this->data = $r;
         $this->processAllWith($r, false);
         if ($this->returnType == 'Object') {
             $item = new static($r);
             $item->isNew = false;
             $objects[] = $item;
         }
     }
     $this->_with = array();
     if ($this->returnType == 'Object') {
         return $objects;
     }
     if ($this->returnType == 'Json') {
         return json_encode($res);
     }
     return $res;
 }