OSB Mod: Update to KH ORM for OSB.

This commit is contained in:
Deon George 2010-08-26 05:13:27 +10:00
parent 6fb7d0035a
commit ba3c9d60aa

View File

@ -400,6 +400,9 @@ class Kohana_ORM {
$this->_object[$column] = $value;
}
elseif (array_key_exists($column, $this->_object))
{
// Only record the change, if the value is actually changed
if ($this->_object[$column] !== $value)
{
$this->_object[$column] = $value;
@ -412,6 +415,7 @@ class Kohana_ORM {
$this->_saved = FALSE;
}
}
}
elseif (isset($this->_belongs_to[$column]))
{
// Update related object itself
@ -834,9 +838,11 @@ class Kohana_ORM {
$data[$column] = $this->_object[$column] = ($format === TRUE) ? time() : date($format);
}
// @todo move this OSB specific site_id processing elsewhere
$query = DB::update($this->_table_name)
->set($data)
->where($this->_primary_key, '=', $this->pk())
->and_where('site_id','=',Config::siteid())
->execute($this->_db);
// Object has been saved
@ -853,6 +859,9 @@ class Kohana_ORM {
$data[$column] = $this->_object[$column] = ($format === TRUE) ? time() : date($format);
}
// @todo move this OSB specific site_id processing elsewhere
$data['site_id'] = Config::siteid();
$result = DB::insert($this->_table_name)
->columns(array_keys($data))
->values(array_values($data))