This was marked fixed, but we still get an exception being thrown. I have a node that is not set to be translatable, which gets 'zxx" as a language when it is created (through a migration process). This causes an exception being thrown inside EntityOperations::updateOrCreateFromEntity at the point when the translation is being added to the $content_moderation_state entity.
if ($entity->getEntityType()->hasKey('langcode')) {
$entity_langcode = $entity->language()->getId();
if (!$content_moderation_state->hasTranslation($entity_langcode)) {
$content_moderation_state->addTranslation($entity_langcode);
}
if ($content_moderation_state->language()->getId() !== $entity_langcode) {
$content_moderation_state = $content_moderation_state->getTranslation($entity_langcode);
}
}
Debugging this, I see that the $content_moderation_state entity has its language set to 'en' (site default), which is why the $content_moderation_state->hasTranslation($entity_langcode) fails ($entity_langcode='zxx').
Should we add extra checks here? or is the problem more that the $content_moderation_state doens't have it's language code set to 'zxx' (like the non-translated entity) ??
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 2856917-10.patch | 2.52 KB | amateescu |
| #10 | 2856917-test-only.patch | 1.74 KB | amateescu |
| #2 | core-content_moderation-2856917-2.patch | 670 bytes | kriboogh |
Comments
Comment #2
kriboogh commentedComment #3
kriboogh commentedComment #5
timmillwoodComment #6
sam152 commentedWhat version was this fixed in? I noticed this was logged against 8.3.x.
Comment #7
timmillwoodIs this still an issue?
Comment #8
tacituseu commentedComment #9
kriboogh commentedNot sure if it is still an issue, we have put content moderation usage on hold until it will be considered stable.
Comment #10
amateescu commentedI just hit this today while working on a test for Content Moderation, so yes, it's still very much an issue :)
Comment #12
timmillwoodNice @amateescu!
Very simple patch and test coverage. Looks like @kriboogh had the right fix, just took a test to prove it.
Comment #14
amateescu commentedThat seemed to be a random fail.
Comment #18
xjmCommitted and pushed to 8.5.x and 8.4.x. Thanks!
Comment #19
xjm(Since it's a straight up non-disruptive bugfix.)