I had a migration group consisting out of 4 (interdependent) migrations, all using the same Excel sheet as source data (although some of them used different sheets within the same file). When I ran the migrations through the CLI using drush, they worked as expected. When I ran the same migrations using MigrateBatchExecutable, some of the migrations failed with "NULL" values. Debugging showed that values were read from an incorrect worksheet (not the one defined in the migrate config).
I am not entirely sure, but I think this is caused by the fact that the SpreadsheetIterator is exposed as a service (migrate_spreadsheet.iterator), and can be re-used between migrations in the same request without being properly reset. In any case, it seems strange to implement an iterator as a service?
When I instantiate the SpreadsheetIterator in the Spreadsheet migrate plugin constructor, my migrations work flawlessly in both CLI and through MBE.
Patch attached for testing/review
Comment | File | Size | Author |
---|---|---|---|
migrate_spreadsheet-iterator.patch | 1.22 KB | mr.baileys |
Comments
Comment #2
claudiu.cristea@mr.baileys, you're absolutely right.
Comment #4
claudiu.cristeaThank you!