Problem/Motivation

The LoadEntity dynamically creates migrations for per bundle migrations when migrating CCK fields. These migrations don't fire the same hooks that are fired when loading a normal migration.

This makes it impossible for a contrib or a custom field module to migrate from D6 to D8. This is serious enough to make the issue major.

Proposed resolution

Manually call the load hooks from LoadEntity.

Remaining tasks

Review

User interface changes

n/a

API changes

Hooks added inline with other entities.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

Priority: Normal » Major
Status: Needs review » Needs work
Issue tags: +Needs tests
chx’s picture

Issue summary: View changes

The last submitted patch, load-entity.patch, failed testing.

benjy’s picture

Status: Needs work » Needs review
FileSize
5.53 KB
1.25 KB

This will fix existing fails. New tests coming later.

benjy’s picture

FileSize
10.05 KB
6.42 KB
9.99 KB

Unit tests and a fail test.

The last submitted patch, 5: 2422221-5-FAIL.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 5: 2422221-5.patch, failed testing.

benjy’s picture

Status: Needs work » Needs review
FileSize
9.99 KB
570 bytes

Fixed namespace.

Status: Needs review » Needs work

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

benjy queued 8: 2422221-8.patch for re-testing.

benjy’s picture

Status: Needs work » Needs review
benjy’s picture

FileSize
9.88 KB
1.29 KB

Fixed a few things from chx's feedback on IRC.

chx’s picture

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

Really nice. I was afraid the test will need a lot more mocking, glad it didn't.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: 2422221-12.patch, failed testing.

benjy queued 12: 2422221-12.patch for re-testing.

benjy’s picture

Status: Needs work » Reviewed & tested by the community

That is a random fail in HEAD.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php
@@ -114,7 +149,7 @@ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = N
+    $this->postLoad($migrations);

+++ b/core/modules/migrate_drupal/src/Plugin/migrate/load/d6/LoadTermNode.php
@@ -13,6 +13,7 @@
@@ -22,9 +23,9 @@ class LoadTermNode extends LoadEntity {

Doesn't LoadTermNode::loadMultiple() also need to call the postLoad method?

Also something is fishy about doing

$migration = $storage->create($values);

And then firing post load hooks.

benjy’s picture

Status: Needs work » Needs review
FileSize
5.96 KB
4.28 KB

Nice catch. As discussed, moved $this->postLoad into MigrationStorage.

benjy’s picture

FileSize
1.04 KB

Not much left :)

benjy’s picture

FileSize
4.26 KB

New unit tests.

chx’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
547 bytes
4.26 KB

Fantastic, so much better. There's a typo in the patch which I fixed.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 80d54fc and pushed to 8.0.x. Thanks!

  • alexpott committed 80d54fc on 8.0.x
    Issue #2422221 by benjy, chx: LoadEntity needs to fire load hooks for...

Status: Fixed » Closed (fixed)

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