Problem/Motivation
When doing an entity query on a revisionable and translatable entity type, which has a field that is translatable but not revisionable the data table and the revision data table need to be queried. Currently the join to query both of these tables is done on the entity ID, which can potentially mean the record for the wrong language.
Proposed resolution
Update the join in the query to use both the entity id and the langcode.
Remaining tasks
Review.
User interface changes
none
API changes
none
Data model changes
none
Comment | File | Size | Author |
---|---|---|---|
#7 | test-only.patch | 2.35 KB | timmillwood |
#7 | interdiff.txt | 2.9 KB | timmillwood |
#7 | non_revisionable-2728403-7.patch | 3.28 KB | timmillwood |
Comments
Comment #2
timmillwoodThis patch updates the non-revisionable field in
\Drupal\entity_test\Entity\EntityTestRev::baseFieldDefinitions
to be translatable, and therefore should cause this issue to happen. Otherwise I'll need to update the patch to add a test to cause this issue to happen.Comment #3
timmillwoodHere's a test for this
Comment #5
xjmComment #7
timmillwoodWhen joining the revision and data tables we were only joining on id and not langcode.
Comment #9
timmillwoodPerfect!
Comment #10
hchonovI think that we need a better explanation of what actually happens. I think that the fields are being saved correctly but not loaded again correctly due to the missing join condition for the language code key.
Beside that +1.
Comment #11
timmillwoodMaking the issue summary a little more understandable.
Comment #12
timmillwoodComment #13
hchonovNot needed empty line between the both assertions, which could be removed on committing this.
Otherwise everything else looks fine.
Comment #14
hchonovComment #17
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!
Comment #18
Gábor Hojtsy