Database Error Handling: What if You have to Call Outside service and the Transaction Fails?
- by Ngu Soon Hui
We all know that we can always wrap our database call in transaction ( with or without a proper ORM), in a form like this:
$con = Propel::getConnection(EventPeer::DATABASE_NAME);
try {
$con->begin();
// do your update, save, delete or whatever here.
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw…