the code is something like:
try {
...
$a->setTransaction($t);
$b->setTransaction($t);
if (!$a->save()) {
$t->rollback();
/*
Do I need add return or throw new Exception(); here to exit current follow and goto finally block?
*/
}
if (!$b->save()) {
$t->rollback();
/*And here*/
}
$t->commit();
}
catch (Exception $e) {
...
}
finally {
...
}