$transaction = $connection->beginTransaction();
try {
// Этап 1
$dbAdapter->insert($data);
// Этап 2
$mailAdapter->sendMessage();
// ...
$transaction->commit();
} catch (Exception $e) {
$transaction->rollback();
throw $e;
}