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.

Comments

jake_milburn created an issue. See original summary.

jake_milburn’s picture

StatusFileSize
new3.89 KB

Initial patch to add the proposed resolution.
Needs documentation added for the new entity key and the new field setting.

jake_milburn’s picture

StatusFileSize
new3.88 KB

Adjust the new key on the entity to be more descriptive and sit in a more sensible place.

fabianx’s picture

Status: Active » Reviewed & tested by the community

RTBC - looks great to me!

gbirch’s picture

RTBC - running well in use.

fabianx’s picture

Assigned: jake_milburn » mcdruid
Category: Feature request » Bug report
Priority: Minor » Major
Issue tags: +Framework Manager Approved

I like this a lot, it has tests and would love to get this into our next release, so over to mcdruid for review.

mcdruid’s picture

Issue tags: +Pending Drupal 7 commit, +Needs change record

Looks good, thanks!

fabianx’s picture

RTBC again, let's get this in!

  • mcdruid committed 74e6ff2 on 7.x
    Issue #3212398 by jake_milburn: [D7] Field API assumes serial/integer...
mcdruid’s picture

Assigned: mcdruid » Unassigned
Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit, -Needs change record

Added the CR.

Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.