1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/codes/Transactions - Nesting.php
2006-07-23 21:08:06 +00:00

24 lines
490 B
PHP

<?php
function saveUserAndGroup(Doctrine_Session $session, User $user, Group $group) {
$session->beginTransaction();
$user->save();
$group->save();
$session->commit();
}
try {
$session->beginTransaction();
saveUserAndGroup($session,$user,$group);
saveUserAndGroup($session,$user2,$group2);
saveUserAndGroup($session,$user3,$group3);
$session->commit();
} catch(Doctrine_Exception $e) {
$session->rollback();
}
?>