/** * public $DM; * public $YZ; * public $M; * public $SD; * @throws Exception * @return boolean */ private static function startMysqlCpimdMemory() { $cpimd_first = CpimdMemory::findFirst(); if (isset($cpimd_first->DM)) { return true; } else { try { $manager = new TxManager(); $transaction = $manager->get(); $cpimd_data = Cpimd::find(); foreach ($cpimd_data as $cpimd_record) { $cpimd_memory = new CpimdMemory(); $cpimd_memory->setTransaction($transaction); $cpimd_memory->DM = $cpimd_record->DM; $cpimd_memory->YZ = $cpimd_record->YZ; $cpimd_memory->M = $cpimd_record->M; $cpimd_memory->SD = $cpimd_record->SD; if ($cpimd_memory->create() == false) { unset($cpimd_data); $transaction->rollback("CPIMD DATA INSERT INTO MEMORY TABLE ERROR!"); } } if (isset($cpimd_data)) { unset($cpimd_data); } $transaction->commit(); return true; } catch (TxFailed $e) { throw new Exception("Failed, reason: " . $e->getMessage()); } } }