1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/manual/codes/Transactions - Nesting.php

24 lines
490 B
PHP
Raw Normal View History

2006-07-24 01:08:06 +04: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();
}
?>