dbObject::get PHP Method

get() protected method

Fetch all objects
protected get ( integer | array $limit = null, array | string $fields = null ) : array
$limit integer | array Array to define SQL limit in format Array ($count, $offset) or only $count
$fields array | string Array or coma separated list of fields to fetch
return array Array of dbObjects
    protected function get($limit = null, $fields = null)
    {
        $objects = array();
        $this->processHasOneWith();
        $results = $this->db->ArrayBuilder()->get($this->dbTable, $limit, $fields);
        if ($this->db->count == 0) {
            return null;
        }
        foreach ($results 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($results);
        }
        return $results;
    }