/** * public $BZ; * public $XH; * @throws Exception * @return boolean */ private static function startMysqlSpmdfMemory() { $spmdf_first = SpmdfMemory::findFirst(); if (isset($spmdf_first->XH)) { return true; } else { try { $manager = new TxManager(); $transaction = $manager->get(); $spmdf_data = Spmdf::find(); foreach ($spmdf_data as $spmdf_record) { $spmdf_memory = new SpmdfMemory(); $spmdf_memory->setTransaction($transaction); $spmdf_memory->XH = $spmdf_record->XH; $spmdf_memory->BZ = $spmdf_record->BZ; if ($spmdf_memory->create() == false) { unset($spmdf_data); $transaction->rollback("SPMDF DATA INSERT INTO MEMORY TABLE ERROR!"); } } if (isset($ksdf_data)) { unset($ksdf_data); } $transaction->commit(); return true; } catch (TxFailed $e) { throw new Exception("Failed, reason: " . $e->getMessage()); } } }