public static function insertCompetency($data) { try { $manager = new TxManager(); $transaction = $manager->get(); foreach ($data as $value) { $competencycomment = new CompetencyComment(); $competencycomment->setTransaction($transaction); foreach ($value as $skey => $svalue) { $competencycomment->{$skey} = $svalue; } if ($competencycomment->save() == false) { $transaction->rollback('数据更新失败-3'); } } $transaction->commit(); return true; } catch (TxFailed $e) { throw new Exception($e->getMessage()); } }