Entity IDs can be strings in Drupal 8

Created on 29 January 2020, almost 5 years ago
Updated 15 December 2023, about 1 year ago

Problem/Motivation

In Drupal 8, entity IDs can be strings.

taxonomy_entity_index table assumes they're all integers which results in an SQL exception if this entity-type is enabled

Proposed resolution

Add a second table taxonomy_entity_index_string for entities with string IDs.
Alter the views integration to join this table in that scenario.
Test coverage using EntityTestStringId in core.

See \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::propertyDefinitions for sample code to work out what sort of column the ID should be.

Remaining tasks

  • Write tests
  • Decide how - if - to support MySQL with ROW_FORMAT=compact (< 5.7) . See #8 and #15. Consider a popular provider like Acquia uses 5.6, on D9 too :( (update: Acquia is upgrading to 5.7)

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024