public function getAll($type = false)
{
$query = 'SELECT ' . $this->select . ' FROM ' . $this->from;
if (!is_null($this->join)) {
$query .= $this->join;
}
if (!is_null($this->where)) {
$query .= ' WHERE ' . $this->where;
}
if (!is_null($this->groupBy)) {
$query .= ' GROUP BY ' . $this->groupBy;
}
if (!is_null($this->having)) {
$query .= ' HAVING ' . $this->having;
}
if (!is_null($this->orderBy)) {
$query .= ' ORDER BY ' . $this->orderBy;
}
if (!is_null($this->limit)) {
$query .= ' LIMIT ' . $this->limit;
}
if ($type == true) {
return $query;
} else {
return $this->query($query, true, $type == 'array' ? true : false);
}
}