2006-07-24 01:08:06 +04:00
|
|
|
<?php
|
2006-08-22 02:51:27 +04:00
|
|
|
function saveUserAndGroup(Doctrine_Connection $conn, User $user, Group $group) {
|
|
|
|
$conn->beginTransaction();
|
2006-07-24 01:08:06 +04:00
|
|
|
|
|
|
|
$user->save();
|
2006-08-22 02:51:27 +04:00
|
|
|
|
2006-07-24 01:08:06 +04:00
|
|
|
$group->save();
|
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
$conn->commit();
|
2006-07-24 01:08:06 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2006-08-22 02:51:27 +04:00
|
|
|
$conn->beginTransaction();
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
saveUserAndGroup($conn,$user,$group);
|
|
|
|
saveUserAndGroup($conn,$user2,$group2);
|
|
|
|
saveUserAndGroup($conn,$user3,$group3);
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
$conn->commit();
|
2006-07-24 01:08:06 +04:00
|
|
|
} catch(Doctrine_Exception $e) {
|
2006-08-22 02:51:27 +04:00
|
|
|
$conn->rollback();
|
2006-07-24 01:08:06 +04:00
|
|
|
}
|
|
|
|
?>
|