'migrationpro_migrated_data', 'primary' => 'id_data', 'fields' => array( 'entity_type' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true), 'source_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'local_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true) ), ); public static function import($entity_type, $source_id, $local_id) { $entity_type = constant("self::TYPE_" . Tools::strtoupper($entity_type)); $sql = 'INSERT INTO ' . _DB_PREFIX_ . 'migrationpro_migrated_data SET entity_type=\'' . pSQL($entity_type) . '\', source_id=' . (int)$source_id . ', local_id=' . (int)$local_id . ' ON DUPLICATE KEY UPDATE local_id=' . (int)$local_id; return Db::getInstance()->execute($sql); } public static function getLocalID($entity_type, $sourceID) { $entity_type = constant("self::TYPE_" . Tools::strtoupper(pSQL($entity_type))); $sql = 'SELECT local_id FROM ' . _DB_PREFIX_ . 'migrationpro_migrated_data WHERE entity_type=\'' . pSQL($entity_type) . '\' AND source_id=' . (int)$sourceID . ';'; return Db::getInstance()->getValue($sql); } public static function getLastId($entity_type) { $entity_type = constant("self::TYPE_" . Tools::strtoupper(pSQL($entity_type))); $sql = 'SELECT source_id FROM ' . _DB_PREFIX_ . 'migrationpro_migrated_data WHERE entity_type=\'' . pSQL($entity_type) . '\' ORDER BY source_id DESC'; return Db::getInstance()->getValue($sql); } }