Problem/Motivation

If a migration has multiple source keys, but you don't give enough values in the --idlist option, then you get this crash:

 [error]  TypeError: Argument 1 passed to Drupal\migrate\Plugin\migrate\id_map\Sql::setUpdate() must be of the type array, bool given, called in /var/www/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php on line 883 in Drupal\migrate\Plugin\migrate\id_map\Sql->setUpdate() (line 844 of /var/www/web/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php) #0 /var/www/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(883): Drupal\migrate\Plugin\migrate\id_map\Sql->setUpdate(false)
#1 [internal function]: Drupal\migrate_tools\Commands\MigrateToolsCommands->executeMigration(Object(Drupal\migrate\Plugin\Migration), 'two_images_para...', Array)

This is because array_combine() returns FALSE if the two arrays aren't of equal length:

          $migration->getIdMap()->setUpdate(array_combine($keys, $source_id_values));

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

joachim created an issue. See original summary.

joachim’s picture

Assigned: Unassigned » joachim

I've got rough working code for this, will clean up and make a MR soon.

ayalon’s picture

I have the same issue and I am very interessted in your fix.

joachim’s picture

Assigned: joachim » Unassigned

Sorry, I got the issues about idlist mixed up -- it's #3248506: import using --idlist parameter should warn if an idlist value wasn't in the source values I have a fix for.

vensires’s picture

Version: 8.x-5.x-dev » 6.1.x-dev
vensires’s picture

Status: Active » Closed (outdated)

Closing this as outdated as it is no longer relevant to the latest 6.1.x version.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.