/** * 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) { $offset = self::$pageLimit * ($page - 1); $this->db->withTotalCount(); $results = $this->get(array($offset, self::$pageLimit), $fields); self::$totalPages = round($this->db->totalCount / self::$pageLimit); return $results; }
/** * 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; }
/** * 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; }