Commit b6a07b65 authored by doctrine's avatar doctrine

PDOException now wrapped into Doctrine_Exception, transaction rollback...

PDOException now wrapped into Doctrine_Exception, transaction rollback whenever PDOException is thrown
parent 15135c68
......@@ -472,18 +472,24 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
if($this->getAttribute(Doctrine::ATTR_VLD))
$this->validator = new Doctrine_Validator();
try {
$this->bulkInsert();
$this->bulkUpdate();
$this->bulkDelete();
if($this->getAttribute(Doctrine::ATTR_VLD)) {
if($this->validator->hasErrors()) {
$this->rollback();
throw new Doctrine_Validator_Exception($this->validator);
}
}
$this->bulkInsert();
$this->bulkUpdate();
$this->bulkDelete();
} catch(PDOException $e) {
$this->rollback();
if($this->getAttribute(Doctrine::ATTR_VLD)) {
if($this->validator->hasErrors()) {
$this->rollback();
throw new Doctrine_Validator_Exception($this->validator);
}
throw new Doctrine_Exception($e->getMessage());
}
$this->dbh->commit();
$this->getAttribute(Doctrine::ATTR_LISTENER)->onTransactionCommit($this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment