OSB Mod: Update to KH ORM for OSB.
This commit is contained in:
parent
6fb7d0035a
commit
ba3c9d60aa
@ -401,15 +401,19 @@ class Kohana_ORM {
|
|||||||
}
|
}
|
||||||
elseif (array_key_exists($column, $this->_object))
|
elseif (array_key_exists($column, $this->_object))
|
||||||
{
|
{
|
||||||
$this->_object[$column] = $value;
|
// Only record the change, if the value is actually changed
|
||||||
|
if ($this->_object[$column] !== $value)
|
||||||
if (isset($this->_table_columns[$column]))
|
|
||||||
{
|
{
|
||||||
// Data has changed
|
$this->_object[$column] = $value;
|
||||||
$this->_changed[$column] = $column;
|
|
||||||
|
|
||||||
// Object is no longer saved
|
if (isset($this->_table_columns[$column]))
|
||||||
$this->_saved = FALSE;
|
{
|
||||||
|
// Data has changed
|
||||||
|
$this->_changed[$column] = $column;
|
||||||
|
|
||||||
|
// Object is no longer saved
|
||||||
|
$this->_saved = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (isset($this->_belongs_to[$column]))
|
elseif (isset($this->_belongs_to[$column]))
|
||||||
@ -834,9 +838,11 @@ class Kohana_ORM {
|
|||||||
$data[$column] = $this->_object[$column] = ($format === TRUE) ? time() : date($format);
|
$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)
|
$query = DB::update($this->_table_name)
|
||||||
->set($data)
|
->set($data)
|
||||||
->where($this->_primary_key, '=', $this->pk())
|
->where($this->_primary_key, '=', $this->pk())
|
||||||
|
->and_where('site_id','=',Config::siteid())
|
||||||
->execute($this->_db);
|
->execute($this->_db);
|
||||||
|
|
||||||
// Object has been saved
|
// Object has been saved
|
||||||
@ -853,6 +859,9 @@ class Kohana_ORM {
|
|||||||
$data[$column] = $this->_object[$column] = ($format === TRUE) ? time() : date($format);
|
$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)
|
$result = DB::insert($this->_table_name)
|
||||||
->columns(array_keys($data))
|
->columns(array_keys($data))
|
||||||
->values(array_values($data))
|
->values(array_values($data))
|
||||||
|
Reference in New Issue
Block a user