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,6 +472,7 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab ...@@ -472,6 +472,7 @@ 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->bulkInsert();
$this->bulkUpdate(); $this->bulkUpdate();
...@@ -484,6 +485,11 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab ...@@ -484,6 +485,11 @@ abstract class Doctrine_Session extends Doctrine_Configurable implements Countab
} }
} }
} catch(PDOException $e) {
$this->rollback();
throw new Doctrine_Exception($e->getMessage());
}
$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