diff -u b/core/lib/Drupal/Core/Entity/EntityFieldManager.php b/core/lib/Drupal/Core/Entity/EntityFieldManager.php --- b/core/lib/Drupal/Core/Entity/EntityFieldManager.php +++ b/core/lib/Drupal/Core/Entity/EntityFieldManager.php @@ -530,8 +530,6 @@ // proper provider setter. See https://www.drupal.org/node/2225961. if ($definition instanceof BaseFieldDefinition) { $definition->setProvider($module); - $definition->setName($field_name); - $definition->setTargetEntityTypeId($entity_type_id); } $field_definitions[$field_name] = $definition; } @@ -578,6 +576,8 @@ // proper provider setter. See https://www.drupal.org/node/2225961. if ($definition instanceof BaseFieldDefinition) { $definition->setProvider($module); + $definition->setName($field_name); + $definition->setTargetEntityTypeId($entity_type_id); } $field_definitions[$field_name] = $definition; } only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php @@ -252,6 +252,8 @@ public function testGetFieldStorageDefinitions() { $field_definition = $this->setUpEntityWithFieldDefinition(TRUE); $field_storage_definition = $this->prophesize(FieldStorageDefinitionInterface::class); $field_storage_definition->getName()->willReturn('field_storage'); + $field_storage_definition->setName(0)->shouldBeCalledTimes(1); + $field_storage_definition->setTargetEntityTypeId('test_entity_type')->shouldBeCalled(); $definitions = ['field_storage' => $field_storage_definition->reveal()];