Do updateWithKeys properly if someone would like to update PRI

This commit is contained in:
Mikael Nordfeldth 2016-01-11 19:52:33 +01:00
parent c1f22f106b
commit 93c614c184
1 changed files with 2 additions and 2 deletions

View File

@ -420,7 +420,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
* @param DB_DataObject &$orig Must be "instanceof" $this * @param DB_DataObject &$orig Must be "instanceof" $this
* @param string $pid Primary ID column (no escaping is done on column name!) * @param string $pid Primary ID column (no escaping is done on column name!)
*/ */
public function updateWithKeys(&$orig, $pid='id') public function updateWithKeys(Managed_DataObject $orig, $pid='id')
{ {
if (!$orig instanceof $this) { if (!$orig instanceof $this) {
throw new ServerException('Tried updating a DataObject with a different class than itself.'); throw new ServerException('Tried updating a DataObject with a different class than itself.');
@ -456,7 +456,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
common_database_tablename($this->tableName()), common_database_tablename($this->tableName()),
implode(', ', $parts), implode(', ', $parts),
$pid, $pid,
$this->_quote($this->$pid)); $this->_quote($orig->$pid));
$result = $this->query($qry); $result = $this->query($qry);
if ($result === false) { if ($result === false) {