You are here

function _migrate_xlat_get_new_id in Migrate 6.2

Same name and namespace in other branches
  1. 6 migrate.module \_migrate_xlat_get_new_id()
1 call to _migrate_xlat_get_new_id()
migrate_xlat in ./migrate.module

File

./migrate.module, line 715

Code

function _migrate_xlat_get_new_id($contenttype, $oldid) {
  $result = db_query("SELECT mcsid\n                      FROM {migrate_content_sets}\n                      WHERE contenttype='%s'", $contenttype);
  while ($row = db_fetch_object($result)) {
    static $maptables = array();
    if (!isset($maptables[$row->mcsid])) {
      $maptables[$row->mcsid] = migrate_map_table_name($row->mcsid);
    }
    $sql = "SELECT destid\n            FROM {" . $maptables[$row->mcsid] . "}\n            WHERE sourceid='%s'";
    $id = db_result(db_query($sql, $oldid));
    if ($id) {
      return $id;
    }
  }
  return NULL;
}