does not support FieldDefinitionInterface::CARDINALITY_UNLIMITED

Many tests lose their sense.

diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module
index e44cc32..ca89b07 100644
--- a/core/modules/entity_reference/entity_reference.module
+++ b/core/modules/entity_reference/entity_reference.module
@@ -210,6 +210,7 @@ function entity_reference_create_instance($entity_type, $bundle, $field_name, $f
       'name' => $field_name,
       'type' => 'entity_reference',
       'entity_type' => $entity_type,
+      'cardinality' => FieldDefinitionInterface::CARDINALITY_UNLIMITED,
       'settings' => array(
         'target_type' => $target_entity_type,
       ),
CommentFileSizeAuthor
#6 interdiff.txt755 bytesamateescu
#6 2167975-6.patch1.62 KBamateescu
#2 2167975-2.patch1.62 KBswentel

Comments

swentel’s picture

Title: entity_referendoes not support FieldDefinitionInterface::CARDINALITY_UNLIMITED » entity_reference_create_instance does not support cardinality
Component: entity system » entity_reference.module
swentel’s picture

Status: Active » Needs review
StatusFileSize
new1.62 KB
aspilicious’s picture

Tests needed?

amateescu’s picture

+++ b/core/modules/entity_reference/entity_reference.module
@@ -192,10 +192,12 @@ function entity_reference_query_entity_reference_alter(AlterableInterface $query
+ * @param integer $cardinality

'int' ;)

Tests needed?

This looks straightforward enough and it's just a helper function after all..

Anonymous’s picture

I also think that it does not require test. This function is used for tests only.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.62 KB
new755 bytes

Here we go, I needed this in a patch yesterday.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 1b252e2 and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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