The schema for the Entity Reference field is incorrect because it says that the entity id is an integer. This does not have to true - see #1823494: Field API assumes serial/integer entity IDs, but the entity system does not

We are also missing a schema for the 'target_uuid' key/value that is added by EntityReferenceFieldItemList::processDefaultValue()

Files: 
CommentFileSizeAuthor
#6 2366877.6.patch4.72 KBalexpott
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,945 pass(es). View
#6 2366877.string-test-only.patch2.63 KBalexpott
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,940 pass(es), 2 fail(s), and 1 exception(s). View
#1 2366877.1.test-only.patch1.5 KBalexpott
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,852 pass(es), 1 fail(s), and 0 exception(s). View
#1 2366877.1.patch2.06 KBalexpott
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,861 pass(es). View

Comments

alexpott’s picture

Status: Active » Needs review
FileSize
2.06 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,861 pass(es). View
1.5 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,852 pass(es), 1 fail(s), and 0 exception(s). View

Here's a patch to fix this a tests the missing target_uuid.

Thinking how to test the string id thing.

Status: Needs review » Needs work

The last submitted patch, 1: 2366877.1.test-only.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
Gábor Hojtsy’s picture

Gábor Hojtsy’s picture

BTW the patch looks good. We need an entity type with a non-numeric id to test this I guess. That should already exist in core, no? If we only want to test the persistence, we can set whatever value we want, unless there is some strict data checking on entity references (in which case that would be delegated to the target entity type I guess, so we need that entity type anyway).

alexpott’s picture

FileSize
2.63 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,940 pass(es), 2 fail(s), and 1 exception(s). View
4.72 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,945 pass(es). View

Here's a patch that adds a test for referencing entities with string IDs. The interdiff is the test only patch :)

The last submitted patch, 6: 2366877.string-test-only.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

It is comfy that the EntityTestStringId entity type was already available indeed. Added test looks great.

  • webchick committed 0577d20 on 8.0.x
    Issue #2366877 by alexpott: Fixed Entity Reference field schema...
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.0.x. Thanks!

Status: Fixed » Closed (fixed)

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