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