Add a MISSING_SOURCE_ITEM event for rolling back rows no longer in the source.

See #2809433: Migrate support for deleting items no longer in the incoming data

CommentFileSizeAuthor
#4 interdiff-2-4.txt1.19 KBmarvil07
#4 3045346-4.patch1.03 KBmarvil07
#2 3045346-2.patch956 bytesquietone

Comments

quietone created an issue. See original summary.

quietone’s picture

Status: Active » Needs review
Related issues: +#2809433: Migrate support for deleting items no longer in the incoming data
StatusFileSize
new956 bytes

The event extracted from the patch in the other issue.

For the committer: The credit goes to all the people in the other issue (see IS).

heddn’s picture

Status: Needs review » Needs work
+++ b/src/Event/MigrateEvents.php
@@ -27,4 +27,17 @@ final class MigrateEvents {
+   * implements a listener, the MigrateExecutable listener (with 1000 weight)

Is this really true? It would be if someone where using migrate tool's executable, but not generically speaking all executables.

marvil07’s picture

Status: Needs work » Needs review
StatusFileSize
new1.03 KB
new1.19 KB

Is this really true? It would be if someone where using migrate tool's executable, but not generically speaking all executables.

Indeed, this only applies when the migrate executable with the required change to trigger the event is used.

It is a strange to point to a migrate_tools class from here, since that module depends on migrate_plus.
I would say it is better if we also declare the event there.

I am adding a new patch with the change here just in case, but we probably want to close this issue, and add the change here directly into #2809433: Migrate support for deleting items no longer in the incoming data.

heddn’s picture

+++ b/src/Event/MigrateEvents.php
@@ -27,4 +27,21 @@ final class MigrateEvents {
+   * \Drupal\migrate\Event\MigrateRowDeleteEvent instance. If no other module
+   * implements a listener, the \Drupal\migrate_tools\MigrateExecutable listener
+   * (with 1000 weight) does a rollback on the item by default. Any other
+   * listener (with lower weight) might take another action (think un-publishing
+   * a node) and want to call $event->stopPropagation() to prevent the rollback.

This is basic event 101. Let's just remove the comment entirely? That solves the dilemma.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Fixing #5 on commit.

  • heddn committed 4450d4f on 8.x-4.x authored by marvil07
    Issue #3045346 by marvil07, quietone, heddn: Add missing source item...
heddn’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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