]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Do updateWithKeys properly if someone would like to update PRI
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 11 Jan 2016 18:52:33 +0000 (19:52 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 11 Jan 2016 18:52:33 +0000 (19:52 +0100)
classes/Managed_DataObject.php

index 7492d9097814dfa6daf3fc12ef96cd1200cc881a..68de8922ce20f2cc217cf29089004e1e086f519c 100644 (file)
@@ -420,7 +420,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
      * @param DB_DataObject &$orig  Must be "instanceof" $this
      * @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) {
             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()),
                             implode(', ', $parts),
                             $pid,
-                            $this->_quote($this->$pid));
+                            $this->_quote($orig->$pid));
 
         $result = $this->query($qry);
         if ($result === false) {