I am more thankful for your project each day.
I have a fairly simple set of tables for oral histories, essentially it is made up of multiple collections, each consisting of many audio (or video) tapes, each of which can consist of many segments or clips. The program used for clipping and indexing the audio files maintains collection-id, audio-id, and clip-id so these can get carried over in the migrate. I was going to write code that would link the tables based on those id values, and maybe some code that would populate a node reference field. But after seeing the issue:
I was wondering if a node reference field in each of the drupal content-types that I'm creating as the target of the migration could be auto-populated as part of the migration process?
Comments
Comment #1
vrteach commentedWell, I didn't work out how to do this within migrate, or drupal. But I was able to write my own code that populates the node reference fields after the migrate, based on the *_node_map tables created by tw/migrate. I'm using the EZsql library for my mysql interface. The code is icky because I built it on the fly late last night.
Comment #2
moshe weitzman commentedIn your prepare hook, you do whatever querying you need to do to find the referenced nid. Then you set a value for the node reference field such as
$node->field_training_id[0]['value'] = $training_id;. You have to run your content sets in the right order so that the referenced nid gets created before the referer.