Right now entity translation metadata (source language and outdated status) are being stored regardless of whether the entity_type/bundle is translation enabled. We should add a check to the hook_entity_{insert|delete} implementations.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ytsurk’s picture

i'm not shure if this bug is related, bug berdir told me so ;)

i get this error

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'theme.bartik.mobile' for column 'entity_id' at row 1: INSERT INTO {translation_entity} (entity_type, entity_id, langcode, source, translate) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => breakpoint [:db_insert_placeholder_1] => theme.bartik.mobile [:db_insert_placeholder_2] => und [:db_insert_placeholder_3] => b [:db_insert_placeholder_4] => 0 ) in translation_entity_entity_insert() (line 516 of /Applications/MAMP/htdocs/d8t/core/modules/translation_entity/translation_entity.module).

here's how to reproduce this error:
on a fresh install (standard or minimal).
enable entity - translation, and add a second language.
add a conent-type (in minimal) and a content for it.
now enable the Picture Field-type - boom.

a second enabling of the Picture Module then works without error, and the filed itself actually works.

andypost’s picture

Suppose we should have a different kind of storage for configurables (contact category, image style)

Edit The easiest fix for now is to check for config_prefix in entity to make sure we are dealing with configEntity also it makes sense to change entity_id to entity_uuid or just does not allow entity*hooks for none integer entity_id as temp workaround

Berdir’s picture

Status: Active » Needs review
FileSize
1.8 KB

I'm not sure how configuration entities will be translated but for the moment, this should fix this for the moment and unblock the vocalary to configuration issue.

Will require a follow-up to support configuration entities but first they actually have to support translations. Might be as easy as making entity_id a string. Not sure about using entity_uuid, because we agreed in another issue to not use it for references.

ytsurk’s picture

nice - patch solves the listed error.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

This makes sense, and it's blocking #1552396: Convert vocabularies into configuration.

plach’s picture

Sorry, I tried to RTBC this earlier but Travelodge's wifi sucks. I agree this is good to go in.

sun’s picture

Priority: Normal » Major

Looks good. Bumping to major, as this seems to block a range of other issues.

tstoeckler’s picture

Didn't find this because the issue title didn't mention the error mentioned in #1, so I opened #1832932: translation_entity_entity_insert() assumes entity IDs are integers. Don't know if that should be a duplicate. It's a different fix, which is also valid, IMO. I guess that one can be demoted once this is in.

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Hm. We should get some tests for this, I think.

Berdir’s picture

Ok, extended both node tests (to check for the bundle specific setting) and the taxonomy term tests to verify that we're not adding wrong rows.

Gábor Hojtsy’s picture

Status: Needs review » Needs work

Tests look good. Only two code comments:

+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.phpundefined
@@ -67,4 +67,23 @@ protected function getNewEntityValues($langcode) {
+   * Test that no metadata is stored for a disabled

... bundle.

+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.phpundefined
@@ -67,4 +67,23 @@ protected function getNewEntityValues($langcode) {
+    // Create a bundle does not have translation enabled.

bundle THAT does not have?

Berdir’s picture

Thanks!

This should be better.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +D8MI, +language-content

Looks all good to me.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, translation-entity-check-support-1832000-12.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Reviewed & tested by the community

That was a known fail that's been fixed since.

webchick’s picture

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

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