1
0
mirror of synced 2025-01-18 14:31:40 +03:00
doctrine2/manual/codes/Transactions - Nesting.php

24 lines
490 B
PHP
Raw Normal View History

2006-07-23 21:08:06 +00:00
<?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();
}
?>