Since a few hours reverting an entity to an older revision that has fewer translations as before leads into a fatal error caused by
Drupal\Core\Entity\EntityStorageException: Invalid translation language (de) specified. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 757 of /Users/mkalkbrenner/git/drupal/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
I assume that this was introduced by #2090983: ContentEntityInterface::getTranslation() should throw an exception when an invalid language is specified.
I attached a patch that includes a failing test to demonstrate the issue.
Comment | File | Size | Author |
---|---|---|---|
#7 | et-revision_revert-2579187-7.patch | 2.28 KB | plach |
revert_translation_exception.patch | 1.52 KB | mkalkbrenner | |
Comments
Comment #2
vijaycs85Comment #4
mkalkbrennerI just checked locally that the test case succeeds with
4a992013d875942451c89b3692490730bc435c7f
but fails with5c0eb9b7a5021c429f751ed378af9da9eaf9b983
.Comment #5
mkalkbrennerI don't think that #2090983: ContentEntityInterface::getTranslation() should throw an exception when an invalid language is specified introduced the issue but simply uncovered the real one.
@plach: I'm not sure yet, but it seems that entity storage iterates over the translations of the latest revision instead of the translations of the revision that is saved.
Comment #6
plachOn this
Comment #7
plachThis should be it
Comment #8
chx CreditAttribution: chx commentedThat looks sensible: the translation we delete must come from the original , it is not on the current one because it is deleted (doh!)
Comment #9
plachExactly, thanks!
Comment #10
alexpottWe have tests and the fix makes sense. Committed 3884a58 and pushed to 8.0.x. Thanks!
Comment #13
Gábor HojtsyWoot, thanks folks!