In case database triggers aren't supported, update target_id_int within Drupal as well

Created on 22 April 2022, over 2 years ago
Updated 10 September 2024, 3 months ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Change DynamicEntityReferenceItem to also keep target_id_int in sync via Drupal. I think that all that needs to be done for this is:

  • DynamicEntityReferenceItem::schema() would need to add target_id_int as another column.
  • DynamicEntityReferenceItem would need to override __get() such that when target_id_int is passed, it returns the integer value of target_id, otherwise call the parent getter.

This could be in addition to leaving the existing trigger approach in place, so that sites where triggers are supported continue to get the benefit of the column staying synchronized even when target_id is updated in the database via something other than the Entity API. But this would enable sites where triggers aren't supported to also be able to use DER 4.x, so long as those sites don't update DER's database values without using the Entity API.

Remaining tasks

  • The latest patch has duplicate code creating the int column. It's now part of the field item schema, but the IntColumnHandler classes still create it too. So we need to remove the column creation from the IntColumnHandler classes while leaving the trigger creation in place.
  • The latest patch still needs a hook_update_N() function written in order to make the update path tests pass.

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs work

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States effulgentsia

Live updates comments and jobs are added and updated live.
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