MigrateExecutable does not process --update option

Created on 16 May 2025, 4 months ago

Problem/Motivation

We have a Openy Traction Rec module that implements migration from CRM to Drupal. There's a designated drush command that we created: tr:import.

This command accepts --update flag the same as migrate:import.
It creates new MigrateExecutable object as follows:

// Get an instance of MigrateExecutable.
$migrate_executable = new MigrateExecutable($migration, new MigrateMessage(), $options);

where $options contains the --update flag.
Link to the code.

We have overlooked the fact that --update flag is not processed in MigrateExecutable constructor and only in the executeMigration method of the MigrateToolsCommands:

    if ($options['update']) {
      if (!$options['idlist']) {
        $migration->getIdMap()->prepareUpdate();
      }
      else {
        $source_id_values_list = MigrateTools::buildIdList($options);
        $keys = array_keys($migration->getSourcePlugin()->getIds());
        foreach ($source_id_values_list as $source_id_values) {
          $migration->getIdMap()->setUpdate(array_combine($keys, $source_id_values));
        }
      }
    }

I am wondering if it would be possible to move this to MigrateExecutable instead? I can provide the PR if we decide on this.

πŸ’¬ Support request
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine Sardis

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

Comments & Activities

Production build 0.71.5 2024