function location_migrate_prepare_location in Migrate Extras 6
Implementation of hook_migrate_prepare().
1 call to location_migrate_prepare_location()
- location_user_migrate_prepare_location_user in ./
location_user.migrate.inc  - Implementation of hook_migrate_prepare().
 
File
- ./
location.migrate.inc, line 48  - Integrates location module with the migrate module
 
Code
function location_migrate_prepare_location(&$loc, $tblinfo, $row) {
  $errors = array();
  //can't load vid from views, so if it's not present, we'll load it.
  if (!isset($loc->vid) && isset($loc->nid)) {
    $sql = "SELECT vid from {node} WHERE nid = %d";
    if ($vid = db_result(db_query($sql, $loc->nid))) {
      $loc->vid = $vid;
    }
    else {
      $errors[] = migrate_message('Could not find a VID for the Supplied NID');
    }
  }
  //note, we could probably do the same for uid here too and not have to have the extra table info stuff in matadormove
  // on second thought, it looks like uid is only used for location_user!
  $context = array(
    'nid' => $loc->nid,
    'vid' => $loc->vid,
    'uid' => $loc->uid,
    'genid' => $loc->genid,
  );
  unset($loc->nid, $loc->vid, $loc->uid, $loc->genid);
  $loc->context = $context;
}