Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is easily reproducible in Lightning, when the Lightning Preview component is installed: #2817231: Author of node entities is not replicated
The crux of the issue is that EntityReferenceItemNormalizer mistakenly overwrites an entire array when it should be adding an element to it. This patch corrects the error. Should probably have an automated test (a unit test of EntityReferenceItemNormalizer would suffice, IMHO), but I tested it manually in Lightning and it works.
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff.txt | 452 bytes | jeqq |
#10 | 2820105-10.patch | 4.55 KB | jeqq |
#9 | 2820105-7.patch | 4.25 KB | josephdpurcell |
#7 | interdiff-2820105-4-7.txt | 921 bytes | phenaproxima |
#7 | 2820105-7.patch | 4.25 KB | phenaproxima |
Comments
Comment #2
phenaproximaComment #3
timmillwoodI'm struggling a little to follow the logic, but it sounds plausible that this is the issue.
Would you be able to add an EntityReferenceItemNormalizerTest? It looks as though we don't even have one https://github.com/relaxedws/drupal-replication/tree/8.x-1.x/tests/src/U...
Comment #4
phenaproximaOkay, here is a test of EntityReferenceItemNormalizer.
Comment #5
josephdpurcell CreditAttribution: josephdpurcell at Digital Bridge Solutions commentedThis looks really good--an important find, obviously. I don't see any required changes, but have some suggestions:
Rename this to testUserReferenceFieldNormalization and update the doc comment.
Add a @todo to write a generic testEntityReferenceFieldNormalization.
Reason: the EntityReferenceItemNormalizer treats users as a special case.
Also add a @todo to test the user mapping.
Also add a @todo to test the username in the field info.
Comment #6
josephdpurcell CreditAttribution: josephdpurcell at Digital Bridge Solutions commentedEscalating to Major since there is no workaround for this.
Comment #7
phenaproximaFixed all but the last one, since that is specifically what is being fixed (and tested) by this patch. :)
Comment #8
josephdpurcell CreditAttribution: josephdpurcell at Digital Bridge Solutions commentedThis looks good, assuming tests pass it can be RTBC'd.
Comment #9
josephdpurcell CreditAttribution: josephdpurcell at Digital Bridge Solutions commentedWill a re-upload work?
Comment #10
jeqqA fix for type check.
Comment #12
jeqqThank you!
Comment #28
jeqqTests started to run after the branch has been fixed and patch commited.