Problem/Motivation
Entities can be created with non numeric IDs but the field system assumes that entities have a numeric ID.
Currently entities with non numeric IDs aren't fieldable.
Proposed resolution
Add a new setting on entities to specify the entity ID type. Starting with support for strings for now.
Add a new setting on field definitions that contains the entity key type.
If a field is added via the UI then we can set the type off of the target entity. If a field is added programmatically then the type can be added into the array passed to field_create_field().
In the field schema add an override that checks if the entity ID type is set and adjusted the entity_id and revision_id columns to be VARCHAR rather than INT.
If we keep this as an override then it does not break backwards compatibility as well.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | support-non-numeric-ids-3212398-3.patch | 3.88 KB | jake_milburn |
| #2 | support_non_numeric_ids-3212398-2.patch | 3.89 KB | jake_milburn |
Comments
Comment #2
jake_milburn commentedInitial patch to add the proposed resolution.
Needs documentation added for the new entity key and the new field setting.
Comment #3
jake_milburn commentedAdjust the new key on the entity to be more descriptive and sit in a more sensible place.
Comment #4
fabianx commentedRTBC - looks great to me!
Comment #5
gbirch commentedRTBC - running well in use.
Comment #6
fabianx commentedI like this a lot, it has tests and would love to get this into our next release, so over to mcdruid for review.
Comment #7
mcdruid commentedLooks good, thanks!
Comment #8
fabianx commentedRTBC again, let's get this in!
Comment #10
mcdruid commentedAdded the CR.
Thanks everyone!