Right now, you have two options with a StaticMap:

- Enforce that all values must be mapped
- Abort if one doesn't map.

We should add a third option (skip_row), so that rows that don't match can be skipped without affecting the whole migration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

benjy’s picture

I think we should make the default to skip row instead of the fatal error. This also saves us having an extra configuration option.

David Hernández’s picture

Status: Active » Needs review
FileSize
1.78 KB

I'm not really sure, but I think this is what is needed to skip rows by default.

rvilar’s picture

It works for me. I'm using it for a use case in my migration on #2225293: Migrate D6 and D7 language negotiation settings

pcambra’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me

benjy’s picture

Project: IMP » Drupal core
Version: » 8.x-dev
Component: Code » migration system
Category: Feature request » Task
Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/StaticMap.php
@@ -46,7 +47,7 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro
+        throw new MigrateSkipRowException(sprintf('Lookup of %s failed.', var_export($value, TRUE)));

We no longer need the sprintf() since the message isn't used anywhere.

Also, moving this into the core issue queue since it's a change in the migrate module which i'm trying to avoid in the sandbox unless it is specifically holding something up.

David Hernández’s picture

Assigned: Unassigned » David Hernández

Ok, fixing it. But this patch is required for #2225293

pcambra’s picture

David Hernández’s picture

Status: Needs work » Needs review
FileSize
1.72 KB
benjy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. This is an API change for the default behaviour for migrations using the static map so we'll need to re-run all the tests in the sandbox too.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: 2222169-8.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review

8: 2222169-8.patch queued for re-testing.

benjy’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed c1cf341 and pushed to 8.x. Thanks!

  • Commit c1cf341 on 8.x by alexpott:
    Issue #2222169 by David Hernández: Add skip_row option to StaticMap.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.