Closed (duplicate)
Project:
Migrate Source CSV
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jul 2019 at 01:08 UTC
Updated:
31 Oct 2019 at 14:27 UTC
Jump to comment: Most recent
Comments
Comment #2
heddnCan you provide more steps to reproduce? I haven't been able to make this happen while using the module.
Comment #3
mindaugasd commentedPatch fixed the issue as described.
Without this patch most UI links do not work, for example:
Debugging
ksm($this->configuration)in CSV.php line 111 showed all things duplicated, so this error.Comment #4
heddnAh, so this is for migrations that come from migrate_plus config entities. And we don't have any tests in the project here for that. Should we add some? Probably.
Comment #5
dinarcon commentedHello, I stumbled upon this while writing a blog post on using Migrate Plus to manage migrations from the user interface. The demo module I am using can be found at https://github.com/dinarcon/ud_migrations It is the
ud_migrations_config_group_csv_sourcesubmodule. Below is a little bit more context of what I found.It is possible to run import operations from the user interface, but it fails upon rollback throwing the error:
InvalidArgumentException: The ids must a flat array with unique string values. in Drupal\migrate_source_csv\Plugin\migrate\source\CSV->__construct() (line 112 of /var/www/drupalvm/drupal/web/modules/contrib/migrate_source_csv/src/Plugin/migrate/source/CSV.php).It only fails when the rollback operation is initiated from the user interface. Issuing a Drush command provided by Migrate Tools works fine for reverting the migration. This happens because keys are duplicated as mentioned in the related issue #3012001: Duplications within migration process plugin. One way to mitigate this in Migrate Source CSV is to apply
array_unique()on both ends of the condition that checks for theidsconfiguration.I can provide a patch for this, but I am not sure if it is desired. There is already a patch in the related Drupal core's issue that will fix the root of the problem described here.
The problem seems to be related to how import and rollback operations initiated from the user interface are handled by Migrate Tools. For imports, when each batch is called, the
$configurationarray passed toforeach (NestedArray::mergeDeep($plugin_definition, $configuration) as $key => $value) {is empty so no key duplication occurs and the validation in Migrate Source CSV passes. For rollback operations, the$configurationarray has values and the problem arises.Comment #6
heddnI think the real fix is #3012001: Duplications within migration process plugin. But let's leave this open while we wait for it to land upstream.
Comment #7
heddnUpstream has landed. Marking fixed here.