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;
}