Add SqlCriteria.join(). Refactoring SqlResultCollection (add SqlResultCollection).

This commit is contained in:
Alexander Demidov
2014-03-06 15:26:59 +04:00
parent 740bd6b7f3
commit 3272d7a903
4 changed files with 113 additions and 19 deletions

View File

@ -33,6 +33,11 @@ abstract class SqlModel extends Model
return $this->db->quote($value);
}
public function getDb()
{
return $this->db;
}
/**
* @param int $id
* @return object
@ -209,7 +214,7 @@ abstract class SqlModel extends Model
$group_by = $this->db->groupByExpr($group_by);
$order = isset($order['sort']) ? $this->order($order, $order['sort']) : false;
$limit = $this->db->limitExpr($limit);
$result_items = $this->fetchAll(
$result = $this->query(
(($sql_expression) ? $sql_expression : ('SELECT ' . $select . ' FROM ' . $this->table()))
. (($where) ? (' WHERE ' . $where) : '')
. (($group_by) ? (' GROUP BY ' . $group_by) : '')
@ -218,7 +223,7 @@ abstract class SqlModel extends Model
$sql_expression_params,
$cache_key
);
return new SqlResultProvider($result_items);
return new SqlResultProvider($result);
}
/**