Example #1
0
 /**
  * 分配被试到面询专家
  */
 public static function allocExaminees($data, $interviewer_id)
 {
     try {
         $manager = new TxManager();
         $transaction = $manager->get();
         foreach ($data as $value) {
             $interview = new Interview();
             $interview->setTransaction($transaction);
             $interview->manager_id = $interviewer_id;
             $interview->examinee_id = $value['id'];
             if ($interview->save() == false) {
                 $transaction->rollback("数据插入失败");
             }
         }
         $transaction->commit();
         return true;
     } catch (TxFailed $e) {
         throw new Exception($e->getMessage());
     }
 }