diff --git a/core/lib/Drupal/Core/Field/Plugin/DataType/DynamicEntityReference.php b/core/lib/Drupal/Core/Field/Plugin/DataType/DynamicEntityReference.php index d1dd091..65741fd 100644 --- a/core/lib/Drupal/Core/Field/Plugin/DataType/DynamicEntityReference.php +++ b/core/lib/Drupal/Core/Field/Plugin/DataType/DynamicEntityReference.php @@ -45,31 +45,4 @@ public function getTarget() { return $this->target; } - /** - * {@inheritdoc} - */ - public function setValue($value, $notify = TRUE) { - unset($this->target); - unset($this->id); - - // Both the entity ID and the entity object may be passed as value. The - // reference may also be unset by passing NULL as value. - if (!isset($value)) { - $this->target = NULL; - } - elseif ($value instanceof EntityInterface) { - $this->target = $value->getTypedData(); - } - elseif (!is_scalar($value) || $this->getTargetDefinition()->getEntityTypeId() === NULL) { - throw new \InvalidArgumentException('Value is not a valid entity.'); - } - else { - $this->id = $value; - } - // Notify the parent of any changes. - if ($notify && isset($this->parent)) { - $this->parent->onChange($this->name); - } - } - } diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DynamicEntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DynamicEntityReferenceItem.php index 6cb4f3a..0b710af 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DynamicEntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DynamicEntityReferenceItem.php @@ -27,7 +27,7 @@ * label = @Translation("Dynamic entity reference"), * description = @Translation("An entity field containing a dynamic entity reference."), * no_ui = TRUE, - * list_class = "\Drupal\Core\Field\EntityReferenceFieldItemList", + * list_class = "\Drupal\Core\Field\DynamicEntityReferenceFieldItemList", * constraints = {"ValidReference" = {}} * ) */ diff --git a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php index c0d4ceb..73b9a89 100644 --- a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php @@ -179,7 +179,7 @@ protected function refreshServices() { protected function generateRandomEntityId($string = FALSE) { srand(time()); do { - $id = $string ? $this->randomMachineName() : mt_rand(1, 0xFFFFFF); + $id = $string ? $this->randomMachineName() : mt_rand(1, 0xFFFFFFFF); } while (isset($this->generatedIds[$id])); $this->generatedIds[$id] = $id;