I'm trying to migrate users and user profiles to site, where both entities might be already present. In this case I would like to overwrite specified fields and leave others in the original state. I'm trying to map
profile_id like this:
uid: plugin: migration_lookup no_stub: true # previous user migration migration: mayors_users # property in the source data source: lau profile_id: plugin: entity_lookup entity_type: profile bundle: profile bundle_key: type value_key: uid source: '@uid'
However, this fails, so
Do you happen to know, how can I use entity_lookup (or another) plugin for this?
EDIT: It looks like this might be a Drupal Core issue. I debugged the code of
EntityLookup.php plugin and printed the actual DB query generated from the entity query:
SELECT base_table.revision_id AS revision_id, base_table.profile_id AS profile_id FROM profile base_table INNER JOIN profile profile ON profile.profile_id = base_table.profile_id WHERE (profile.uid = '153') AND (profile.type = 'profile')
This works fine and return following result when used directly against MySQL server:
$query->execute() still returns an empty array. Why?
EDIT: It looks like this might be a bug: https://www.drupal.org/project/migrate_plus/issues/3230477