Problem/Motivation
Over in #2766175: Fix the Views integration for entities with string ids., a helper method (now already committed) was introduced: DynamicEntityReferenceItem::entityHasIntegerId() to determine which column should be used for joining tables, etc.
This results in code looking something like:
'relationship field' => $target_entity_id_is_int ? $field_name . '_target_id_int' : $field_name . '_target_id' ,
If we added an additional helper method, this code could usually be simplified to something like:
'relationship field' => DynamicEntityReferenceItem::getTargetIdColumnName($field_name, $entity_type_id),
Proposed resolution
Add the method.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
jhedstromComment #3
jhedstromThis adds a unit test that covers the 2 new helper methods.
Comment #6
jhedstromForgot the
@groupannotation.Comment #7
jibranHow about something like this?
Comment #8
jhedstromJust briefly reviewing #7 in the context of #2678756: Allow config entities to be flagged, it looks like we don't always have a FieldStorageDefinition in all the places where this helper method would be called (take for instance
flag_views_data_alter()or any of the number of calls inFlagService). Needing to load the storage definition before calling the helper method seems...less helpful :)Comment #9
jibranHow about passing
$entity_type_idand$field_nameinstead?Comment #10
jhedstromI might be missing something, but that's what the patch in #6 does...
Comment #11
jibranI meant something like this.
Comment #12
jhedstromThis looks good--I'll test it by rerolling #2678756: Allow config entities to be flagged to utilize this.
Comment #13
jhedstromThis works as expected.
Comment #14
jibranCommitted to 8.x-2.x branch.