Current implementation can create and save stubs with wrong bundle of real entity. And then due to code in Drupal\Core\Entity\ContentEntityBase::onChange() method entity behavior becomes broken.

This can be reproduced in next scenario:
2) We have two node types: article, news.
1) During deployment the menu link entity with link to non-existing news node is replicated first.
In this case the stub node is created and saved with 'article' bundle.
2) Then the real news node is replicated, the bundle is 'news' now. But after replication fields configured only for 'news' bundle are not replicated.

The solution is to create stubs with correct bundle.

Comments

undertext created an issue. See original summary.

undertext’s picture

Status: Active » Needs review
StatusFileSize
new7.67 KB
undertext’s picture

And this is test-only-patch

undertext’s picture

Fixed namespace of test.

undertext’s picture

StatusFileSize
new6.11 KB

Status: Needs review » Needs work

The last submitted patch, 5: stubs-correct-bundle-2875181-test-only-4.patch, failed testing.

  • jeqq committed 261f6e1 on 8.x-1.x authored by undertext
    Issue #2875181 by undertext, jeqq: Create stubs with correct bundle
    
jeqq’s picture

Status: Needs work » Fixed

Thank you @undertext!

Status: Fixed » Closed (fixed)

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