I have a migration (products) that uses another migration (images) through the migration process plugin.
There are some images missing, so stub rows with "sample value" file entities are generated.
But the stub rows are not saved to the migration map of image migration. This means that new files are being generated every time the migration runs.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miiimooo created an issue. See original summary.

miiimooo’s picture

A first shot at fixing this issue.

This patch adds a function processStubRow to MigrationInterface and an implementation to MigrateExecutable that saves the stub's id(s) to the map of the migration used in the process migration plugin. The processing and importing is moved from the Migration process plugin into the MigrateExecutable.

miiimooo’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: save_stub_in_process_map-2639144-1.patch, failed testing.

miiimooo’s picture

Add missing return statement.

miiimooo’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 5: save_stub_in_process_map-2639144-2.patch, failed testing.

milesw’s picture

This just bit me while migrating a node type that has an entity reference to the same node type. Running the migration would leave a bunch of stubs that were not accounted for in the map table.

Patch #5 seems to work great with 8.0.3, thanks.

milesw’s picture

Some things I'm noticing with migrations that involve stubs:

1. Migration counts are reported wrong. One migration with 434 items reports "Processed 715 items (591 created, 124 updated, 0 failed, 0 ignored)"

2. Rollbacks do not delete all items. The rollback_action in the map table is being set to "preserve" for some items. I believe this is caused by DestinationBase::setRollbackAction().

3. Some chained references are not migrating. Within one migration I have nodes that reference other nodes that in turn reference themselves. This probably isn't supported by Migrate anyway and is not a consequence of the patch.

milesw’s picture

Version: 8.0.0 » 8.0.x-dev
Status: Needs work » Needs review
FileSize
4.71 KB

Updated patch from #5 to return the $destination_ids in MigrateExecutable::processStubRow(). The lack of a return value was the cause of my missing references.

Status: Needs review » Needs work

The last submitted patch, 10: migrate-2639144-10-save-stub-in-process-map.patch, failed testing.

The last submitted patch, 5: save_stub_in_process_map-2639144-2.patch, failed testing.

benjy’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#2639144: Stub row isn't saved in map

This is a duplicate of #2682705: Migrate process plugin does not save stubs to the idmap, leads to duplicates and broken references which has a green patch now. @milesw and @miiimooo if you want to comment on that issue you should still get credit.