public function updateArchiveTime() { $data = $this->fetchAll("bom_upd_time is null or bom_upd_time = '0000-00-00 00:00:00'")->toArray(); $newbom = new Product_Model_Newbom(); $updbom = new Product_Model_Updbom(); foreach ($data as $fa) { if (!$fa['nid']) { continue; } $nid = $fa['nid']; if ($fa['ver'] == '1.0') { $row = $newbom->fetchRow("id = {$nid}"); if ($row) { $archive_time = $row['archive_time']; } } else { $row = $updbom->fetchRow("id = {$nid}"); if ($row) { $archive_time = $row['archive_time']; } } if (isset($archive_time)) { $this->update(array('bom_upd_time' => $archive_time), "sid = " . $fa['sid']); } } }