When locking, use the results to reload the object fields fresh as they may have changed since the object was loaded

This commit is contained in:
Isaac Connor 2021-08-06 19:14:43 -04:00
parent f2a1d06f64
commit 500ced2dc5
1 changed files with 5 additions and 0 deletions

View File

@ -434,6 +434,11 @@ class ZM_Object {
$row = dbFetchOne("SELECT * FROM `$table` WHERE `Id`=?", NULL, array($this->Id()));
if ( !$row ) {
Error("Unable to lock $class record for Id=".$this->Id());
} else {
// row may have been modified since initial load
foreach ($row as $k => $v) {
$this->{$k} = $v;
}
}
}
public function remove_from_cache() {