Problem/Motivation

The migration process plugin allows to transform references to content which was already migrated or will be migrated at some point.
For broken external services though, you also want to be able to just skio values, which don't have migrated data.

Proposed resolution

Add an option to skip empty destinations.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new0 bytes

Here is just a patch so far

Status: Needs review » Needs work

The last submitted patch, 2: 2639254-2.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new740 bytes

Ha

dawehner’s picture

Issue summary: View changes
chx’s picture

Besides testing, the handbook needs upgrading with ample warning on how this actually does not import data.

dawehner’s picture

StatusFileSize
new4.92 KB
new4.79 KB

There we go, now also with some form of test coverage.

edysmp’s picture

Another option without this patch is:

-
plugin: static_map
bypass: TRUE
map:
  '': null
-
plugin: skip_on_empty
method: process
-
plugin: migration
migration: foo

But I like the patch. It makes the DX a lot easier.

chx’s picture

You can't; this patch skips stubbing -- this means phenaproxima was right when he said it's cleaner to call it no_stubbing

edysmp’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Actually, after looking at the migration plugin, I don't think #8 is a possibility. Let's go with it.

benjy’s picture

We already have "no_stub" which does the same thing in the destination, these two names could be easily confused, shall we make them the same?

chx’s picture

Well. I put them on the destination because I thought it's the destination which can determine it just can not be stubbed. But perhaps we do need both? Like, it is possible in general for a destination to be stubbed but in specifics we do not want so?

dawehner’s picture

Yeah there might be references in tables which are just broken. I learned here: never trust a 3rd party source.

benjy’s picture

Status: Reviewed & tested by the community » Needs review

Well. I put them on the destination because I thought it's the destination which can determine it just can not be stubbed. But perhaps we do need both? Like, it is possible in general for a destination to be stubbed but in specifics we do not want so?

I think in general it makes sense for the destination to have the settings when you're talking about the current migration but dawehner's problem here is that he wants to allow broken/missing data from another migration that is referenced. I think renaming to no_stub the same as the destinations would be more consistent and then the patch here looks good.

+++ b/core/modules/migrate/tests/src/Unit/process/MigrationTest.php
@@ -0,0 +1,91 @@
+namespace Drupal\Tests\migrate\Unit\process;
+use Drupal\Core\Entity\EntityStorageInterface;

Missing new line

dawehner’s picture

StatusFileSize
new4.92 KB
new525 bytes

Thank you for your comment/review. Here is the newline

chx’s picture

Status: Needs review » Reviewed & tested by the community

Let's do this.

benjy’s picture

I think renaming to no_stub the same as the destinations would be more consistent

I still think this would be better. Even if skip_stubbing is a better name, consistency is the most important bit for me.

heddn’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new4.9 KB
new1.43 KB

Responding to #17.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Nice, well I just care about getting this done.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!

  • catch committed 95ce9eb on
    Issue #2639254 by dawehner, heddn: Make it possible to skip empty...

  • catch committed 1d021f6 on
    Issue #2639254 by dawehner, heddn: Make it possible to skip empty...

Status: Fixed » Closed (fixed)

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