You are here

function _migrate_xlat_get_new_id in Migrate 6

Same name and namespace in other branches
  1. 6.2 migrate.module \_migrate_xlat_get_new_id()
3 calls to _migrate_xlat_get_new_id()
comment_migrate_import_comment in modules/comment.migrate.inc
Implementation of hook_migrate_import_comment().
MigrateCommentTest::testComment in tests/modules/core/migrate_comment.test
Test comment migration
migrate_xlat in ./migrate.module

File

./migrate.module, line 1292
This module provides tools at "administer >> content >> migrate" for analyzing data from various sources and importing them into Drupal tables.

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;
}