Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 296285

MigrateLookup plugin has inconsistent return values.

$
0
0

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.'


Viewing all articles
Browse latest Browse all 296285

Trending Articles