dbObject::paginate PHP Méthode

paginate() private méthode

Pagination wraper to get()
private paginate ( integer $page, array | string $fields = null ) : array
$page integer Page number
$fields array | string Array or coma separated list of fields to fetch
Résultat 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;
    }