It seems that this should be completely straightforward (http://drupal.org/node/1536914) , but I can't get it to work.
I have two node migrations at the moment: clubs and athletes. Athletes is dependent on clubs, and clubs has already run successfully. The Athlete node contains an entity reference field, field_club, that points to Club nodes. In the migration class that handles Athletes, I have:
$this->addFieldMapping('field_club', 'club')
->sourceMigration('ImdClub');
I've verified that the value of club is correct. If I map club to another field using the same source migration parameter, I see the expected NID appear in that field. However, I can't get this value to migrate into the entity reference field, field_club. After the athlete migration, field_club is empty, i.e. no value for target_id at:
$node->field_club['und'][0]['target_id']
Do I need to do more than this to get entity reference to recognize the mapped value as the target_id?
Working with Migrate 7.x-2.5 and Entity Reference 7.x-1.0
Thanks in advance for any help or pointers for troubleshooting!
Dave
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | entityreference_migrate-1845986-2.patch | 414 bytes | mikeryan |
Comments
Comment #1
mikeryanMy bad, patch coming...
Comment #2
mikeryanTry this.
Comment #3
dave bruns commentedThat's it. Awesome.
Thanks for the great support!
Comment #4
mikeryanNot so fast with the closure;) - until it's committed to the module other migrators will face the same problem.
I did these patches for all the field-handling modules I could find, to my relief this looks like the only one I screwed up...
Comment #5
mikeryanComment #6
dave bruns commentedRight. That makes sense.
I realized that I had found a bug, but I was thinking only about my own situation :-)
Comment #7
marcoka commentedok the patch seems right according to the latest migrate changes here: http://drupal.org/node/1824884
see heading "Destination and field handler classes"
Comment #8
amitaibuCommitted, thanks.
Comment #9
benjifisherThanks to all: dave bruns for reporting the bug, mikeryan for fixing it, and Amitaibu for committing it. You all make my job easier!