updateKeys -> updateWithKeys (w/ functionality)

This commit is contained in:
Mikael Nordfeldth
2015-01-25 12:07:26 +01:00
parent e38d78eba9
commit 4917a422a1
9 changed files with 17 additions and 14 deletions

View File

@@ -322,13 +322,16 @@ abstract class Managed_DataObject extends Memcached_DataObject
}
// 'update' won't write key columns, so we have to do it ourselves.
public function updateKeys(&$orig)
// This also automatically calls "update" _before_ it sets the keys.
public function updateWithKeys(&$orig)
{
if (!$orig instanceof $this) {
throw new ServerException('Tried updating a DataObject with a different class than itself.');
}
$this->_connect();
// Update non-keys first, if necessary.
$this->update($orig);
$parts = array();
foreach ($this->keys() as $k) {
if (strcmp($this->$k, $orig->$k) != 0) {