Problem/Motivation

If a new MigrateSkipRowException('some message', FALSE) is thrown in a processor ::transform() method, the second argument $save_to_map (here FALSE) is not respected when writing to id map.

There are processors that don't want to record such mappings because, for instance, they are skipping rows where the $value cannot be saved in id map. Example 'foo' cannot be saved in 'source1' of type integer.

The "test only" patch from #3 proves the bug.

Proposed resolution

  • Write automated test (see #3)
  • Propose a fix (see #4)

Remaining tasks

Review test and fix.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Title: Be respectful to $save_to_map when registering a skipped row to map » Be respectful with $save_to_map when registering a skipped row to map
claudiu.cristea’s picture

Status: Active » Needs review
StatusFileSize
new3.5 KB
new2.88 KB

Patches.

claudiu.cristea’s picture

StatusFileSize
new3.5 KB
new1.4 KB

Typo.

The last submitted patch, 3: 2818799-3-text-only.patch, failed testing.

claudiu.cristea’s picture

Issue summary: View changes
imiksu’s picture

Title: Be respectful with $save_to_map when registering a skipped row to map » MigrateSkipRowException $save_to_map being TRUE, does not skip silently as should
Issue summary: View changes

Some improvements on bug description, summary and title.

imiksu’s picture

Issue summary: View changes
claudiu.cristea’s picture

@iMiksu, thank you for taking care

benjy’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me, personally i'd like to have seen $save_to_map default to TRUE because $id_map->saveIdMapping($row, array(), MigrateIdMapInterface::STATUS_IGNORED); is invalid anyway. When you attempt to rollback, you'll get cannot flip non-string or integer value errors when it attempts to load null which is saved as the destination id, but that's an existing issue.

claudiu.cristea’s picture

@benjy, thank you. This is somehow related, can you take a look? #2818871: Allow logging skip row exception messages.

  • catch committed 7ca0caf on 8.3.x
    Issue #2818799 by claudiu.cristea: MigrateSkipRowException  being TRUE,...

  • catch committed 58c0cba on 8.2.x
    Issue #2818799 by claudiu.cristea: MigrateSkipRowException  being TRUE,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!

Status: Fixed » Closed (fixed)

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