$transaction=Yii::app()->db->beginTransaction();
try{
$model1->save();
$model2->save();
$model3->save();
$model4->save();
$model5->save();
//出错
$model6->save();
$transaction->commit();
} catch(Exception $e){
$transaction->rollBack();
}
model1 , model2 , model3 , model4 , model5 照样存储成功!