MigrateLookup plugin has inconsistent return values.

Created on 29 June 2017, over 7 years ago
Updated 12 August 2024, 5 months ago

Method \Drupal\migrate\Plugin\migrate\process\MigrationLookup::transform() has two different return values:

  1. If the lookup succeeds it returns the result of \Drupal\migrate\Plugin\MigrateIdMapInterface::lookupDestinationId()
  2. If the lookup fails and stubbing is allowed it returns the result of \Drupal\migrate\Plugin\MigrateDestinationInterface::import()

The first is documented as:

   * @return array
   *   The destination identifier values of the record, or empty on failure.

The second as:

   * @return mixed
   *   The entity ID or an indication of success.

In practice the import() call always returns an array containing the entity id as the array key. While lookupDestinationId returns values numerically indexed.

This leads to the problems described in #2810907: Migrate SQL Map doesn't get array keys for compound keys β†’
That ticket was apparently closed because it has workarounds for 2 situations:
- no stubs are present (you can use keys '0' and '1')
- all referenced content is stubbed (you can use keys 'id' and 'revision_id')

I'm opening this ticket for the case where you have both stubs and real content. You'll get the error 'Array index missing, extraction failed.'

πŸ› Bug report
Status

Closed: won't fix

Version

9.5

Component
MigrationΒ  β†’

Last updated about 13 hours ago

Created by

πŸ‡³πŸ‡±Netherlands JvE

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024