diff --git a/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php b/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php index 1403d8eb63..9d985b2142 100644 --- a/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php +++ b/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php @@ -131,7 +131,7 @@ public function defaultValuesFormSubmit(array $element, array &$form, FormStateI /** * Removes the items with a specific target ID. * - * @param int $target_id + * @param int|string $target_id * The target id of the item to be removed. * * @return $this diff --git a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php index 78afbe9949..263612dcee 100644 --- a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php +++ b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php @@ -106,21 +106,21 @@ public function normalize($field_item, $format = NULL, array $context = []) { /** * Checks whether the referenced entity is of a fieldable entity type. * - * @param \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem $ref + * @param \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem $item * The reference field item whose target entity needs to be checked. * * @return bool * TRUE when the referenced entity is of a fieldable entity type. */ - protected function targetEntityIsFieldable(EntityReferenceItem $ref) { - $target_entity = $ref->get('entity')->getValue(); + protected function targetEntityIsFieldable(EntityReferenceItem $item) { + $target_entity = $item->get('entity')->getValue(); if ($target_entity !== NULL) { return $target_entity instanceof FieldableEntityInterface; } - $referencing_entity = $ref->getEntity(); - $target_entity_type_id = $ref->getFieldDefinition()->getSetting('target_type'); + $referencing_entity = $item->getEntity(); + $target_entity_type_id = $item->getFieldDefinition()->getSetting('target_type'); // If the entity type is the same as the parent, we can check that. This is // just a shortcut to avoid getting the entity type defintition and checking @@ -133,7 +133,7 @@ protected function targetEntityIsFieldable(EntityReferenceItem $ref) { $target_entity_type = $this->entityTypeManager->getDefinition($target_entity_type_id); $target_entity_type_class = $target_entity_type->getClass(); - return in_array(FieldableEntityInterface::class, class_implements($target_entity_type_class), TRUE); + return is_a($target_entity_type_class, FieldableEntityInterface::class, TRUE); } /** diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install index e1a2c45dcf..493850543f 100644 --- a/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -14,8 +14,6 @@ function taxonomy_update_8501() { $definition = $manager->getFieldStorageDefinition('parent', 'taxonomy_term'); $definition->setCustomStorage(FALSE); $manager->updateFieldStorageDefinition($definition); - // Update the entity type because a new interface was added to Term entity. - $manager->updateEntityType($manager->getEntityType('taxonomy_term')); } /** diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php index 58ab9e825e..81bd6796b5 100644 --- a/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php @@ -32,7 +32,7 @@ public function testTaxonomyQueryAlter() { } // Set up hierarchy. Term 2 is a child of 1. - $terms[2]->parent->setValue($terms[1]->id()); + $terms[2]->parent = $terms[1]->id(); $terms[2]->save(); $term_storage = \Drupal::entityManager()->getStorage('taxonomy_term');