Problem/Motivation
I have a migration where certain rows are skipped. The migration is run with the --sync option so that rows which are removed from the source, get removed from the destination.
When a row which was skipped on import, gets removed from the source, the "drush migrate:import --sync" command throws a warning:
[warning] array_flip(): Can only flip STRING and INTEGER values! EntityStorageBase.php:312
Steps to reproduce
Install attached demo module.
Move the users.csv file to your /tmp/ directory.
Run: drush migrate:import --sync user_rollback_skipped_demo
Remove the last line from /tmp/users.csv (the one that got skipped).
Run again: drush migrate:import --sync user_rollback_skipped_demo
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 3260646-17.patch | 840 bytes | uniquename |
| #7 | interdiff_5-7.txt | 1.31 KB | heddn |
| #7 | 3260646-7.patch | 1016 bytes | heddn |
Issue fork migrate_tools-3260646
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
erwin de vylder commentedPatch attached. Hope this works.
Comment #3
ras-ben commentedPatch works for me :)
Comment #4
heddnthis isn't proper code style.
Comment #5
pcate commentedUpdated patch to fix code formatting.
Comment #6
solideogloria commentedConfirmed the issue and the fix works for me.
Comment #7
heddnI think this is a better fix as we don't want to trigger the various events or even deletes if we don't pull back destination IDs. Can someone confirm?
Comment #8
solideogloria commented#7 doesn't fix the original issue, as I get the
array_flip(): Can only flip string and integer valueswarnings again.So it either needs improvement somehow, or #5 should be used.
Comment #9
solideogloria commentedComment #10
heddnIs the reason #7 didn't work because the return value isn't truly null?
Comment #11
solideogloria commentedYes. It returns an empty array in this case.
Also, it should be noted that those functions say the return type is
array, but the doc comments say it can return null.This in itself is a conflict:
It should either have
array|nullin the comments and?arrayas the return type hint, or it should remove the comment about it returning NULL if it never will.Comment #13
heddnThis should fix it.
Comment #15
juagarc4 commentedThis issue seems not to be fixed.
I still have the same warning and I installed the last dev version and I can't see the changes of the patch in the code.
And the patch doesn't apply anymore.
Comment #16
juagarc4 commentedSorry I have already seen, that it was replaced by a new change afterwards.
Comment #17
uniquename commentedIt seems that the changes got removed in https://www.drupal.org/project/migrate_tools/issues/3397550
Find a patch attached that applies to 6.0.4
Comment #18
solideogloria commented@uniquename Please open a new issue. This issue is closed and might not get any visibility from the maintainer.
Comment #19
uniquename commentedHere is a follow up ticket. https://www.drupal.org/project/migrate_tools/issues/3432321