Browse Source

Merge 2f3bc28586 into cb12b6f3ec

pull/641/merge
David Goodwin 6 months ago
committed by GitHub
parent
commit
7743372a66
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 16
      model/PFAHandler.php

16
model/PFAHandler.php

@ -590,20 +590,28 @@ abstract class PFAHandler
unset($db_values[$key]);
} # remove 'dont_write_to_db' columns
}
$pdo = db_connect();
try {
// start db transaction
$pdo->beginTransaction();
if ($this->new) {
$result = db_insert($this->db_table, $db_values, array('created', 'modified'), true);
} else {
$result = db_update($this->db_table, $this->id_field, $this->id, $db_values, array('modified'), true);
}
// problems with this -> postSave, if it executes a db query, will not see the updated db values until this
// transaction has been committed.
$result = $this->postSave();
// commit db transaction
$pdo->commit();
} catch (PDOException $e) {
// rollback
$pdo->rollBack();
$this->errormsg[] = Config::lang_f($this->msg['store_error'], $this->label);
return false;
}
$result = $this->postSave();
# db_log() even if postSave() failed
db_log($this->domain, $this->msg['logname'], $this->id);

Loading…
Cancel
Save