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.
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.
Comments
Comment #1
ytsurki'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.
Comment #2
andypostSuppose 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 workaroundComment #3
BerdirI'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.
Comment #4
ytsurknice - patch solves the listed error.
Comment #5
tim.plunkettThis makes sense, and it's blocking #1552396: Convert vocabularies into configuration.
Comment #6
plachSorry, I tried to RTBC this earlier but Travelodge's wifi sucks. I agree this is good to go in.
Comment #7
sunLooks good. Bumping to major, as this seems to block a range of other issues.
Comment #8
tstoecklerDidn'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.
Comment #9
webchickHm. We should get some tests for this, I think.
Comment #10
BerdirOk, 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.
Comment #11
Gábor HojtsyTests look good. Only two code comments:
... bundle.
bundle THAT does not have?
Comment #12
BerdirThanks!
This should be better.
Comment #13
Gábor HojtsyLooks all good to me.
Comment #15
tim.plunkettThat was a known fail that's been fixed since.
Comment #16
webchick#12: translation-entity-check-support-1832000-12.patch queued for re-testing.
Comment #17
webchickCommitted and pushed to 8.x. Thanks!