YII 中的事务处理机制

$model=Post::model();
$transaction=$model->dbConnection->beginTransaction(); 
try$post=$model->findByPk(10);  
  $post->title='new post title';  
  $post->save();  
  $transaction->commit(); 
}catch(Exception $e){
    $transaction->rollBack(); 
}

摘至:http://blog.csdn.net/xinqingch/article/details/8186745

posted @ 2014-06-30 01:04  chenzsh  阅读(314)  评论(0编辑  收藏  举报