Hi,

I have data coming from two different sources. I need to run one source at node create and other to be import at node update. migrate provide to map nids with some sources. but i have same Id in both sources. I dont want to map nids with source id but I have mapped source id in node create import in title. now I want to map title(instead of nids) with source id on node update import.
Does some one have ideas?
Thanks

Comments

mikeryan’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

I'm having trouble understanding the scenario... Are you saying that in your second (update) migration, you want to be able to identify the target node by title rather than by nid? If so, you can map the title to the nid in a field mapping, and in prepareRow() look up the title to get the nid. E.g.

  $this->addFieldMapping('nid', 'source_title');
...
public function prepareRow($row) {
  // Translate the incoming title to the correct node ID
  $row->source_title = db_select('node', 'n')
    ->fields('n', array('nid'))
    ->condition('title', $row->source_title)
    ->execute()
    ->fetchField();
}
mikeryan’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No further information provided.