0

My custom Drupal 7 to Drupal 8 migration correctly follows dependencies and first migrates users, then articles. The problem is that it fails to import user IDs into the 'uid' field and leaves it at '0'. For uid processing, I use the following YAML snipped. Note that 'luxus_users' is the user migration that works fine.

process:
    uid:
         plugin: iterator
         source: uid
         process:
           target_id:
               plugin: migration
               migration: luxus_users
               source: uid

I hoped would work for me as similar one for file migration already works for me.

field_logo:
     plugin: iterator
     source: field_logo
     process:
       target_id:
         plugin: migration
         migration: luxus_files
         source: fid
0

The difference is that the fid you're migrating is part of a reference field with an internal structure, which makes 'iterator' appropriate. For nodes, however, uid is a simple property, not a field array, so you can map it more directly:

process:
  uid:
    plugin: migration
    migration: luxus_users
    source: uid
  • Thanks for your answer. I tried your direct approach before a tried the iterator one, but with no success. While all users are migrated correctly including user pictures, the uid is not imported to Drupal 8 content nodes. Even hard-wired 'default_value' is not imported...Looks like my uid field is cursed :-) – Tomáš Bažant May 30 '17 at 20:18
  • Oops, my example was wrong, I kept the 'process:' from the iterator, I've fixed my example in my original reply. – Mike Ryan May 31 '17 at 14:23
  • Yes, I noticed that. Still even the 'fixed' version does not assign a uid to an article, leaving it at 0. – Tomáš Bažant Jun 2 '17 at 8:51
  • It's hard to imagine then why it's not working for you. Have you looked at migrate_map_luxus_users to make sure it does have proper mappings from D7 uids (sourceid1) to D8 uids (destid1)? – Mike Ryan Jun 3 '17 at 14:28
  • Yes, the migrate_map_luxus_users table has the correct mappings. – Tomáš Bažant Jun 5 '17 at 6:00
0

The following piece of code works for me now:

uid:
  plugin: migration
  migration: luxus_users
  source: node_uid

Dont know why all the examples refer to 'uid' which is nto part of the $row...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.