Allow actions to be performed on updateWithKeys

Avoids overloading and lets dataobject classes use onUpdateKeys()
to do special stuff, like if a key is made up of a hash of other fields etc.
This commit is contained in:
Mikael Nordfeldth 2016-03-23 15:19:50 +01:00
parent 8933022edc
commit 250d99d997

View File

@ -483,6 +483,8 @@ abstract class Managed_DataObject extends Memcached_DataObject
throw new ServerException('DataObject must be the result of a query (N>=1) before updateWithKeys()'); throw new ServerException('DataObject must be the result of a query (N>=1) before updateWithKeys()');
} }
$this->onUpdateKeys($orig);
// do it in a transaction // do it in a transaction
$this->query('BEGIN'); $this->query('BEGIN');
@ -580,6 +582,11 @@ abstract class Managed_DataObject extends Memcached_DataObject
// NOOP by default // NOOP by default
} }
protected function onUpdateKeys(Managed_DataObject $orig)
{
// NOOP by default
}
public function insert() public function insert()
{ {
$this->onInsert(); $this->onInsert();