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 ...@@ -472,18 +472,24 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
if($this->getAttribute(Doctrine::ATTR_VLD)) if($this->getAttribute(Doctrine::ATTR_VLD))
$this->validator = new Doctrine_Validator(); $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(); } catch(PDOException $e) {
$this->bulkUpdate(); $this->rollback();
$this->bulkDelete();
if($this->getAttribute(Doctrine::ATTR_VLD)) { throw new Doctrine_Exception($e->getMessage());
if($this->validator->hasErrors()) {
$this->rollback();
throw new Doctrine_Validator_Exception($this->validator);
}
} }
$this->dbh->commit(); $this->dbh->commit();
$this->getAttribute(Doctrine::ATTR_LISTENER)->onTransactionCommit($this); $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