diff -u b/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php --- b/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php @@ -89,7 +89,7 @@ $this->derivatives[$entity_type_id] = [ 'label' => $entity_type->getLabel(), 'constraints' => $entity_type->getConstraints(), - 'internal' => $entity_type->getKey('internal'), + 'internal' => $entity_type->get('internal'), ] + $base_plugin_definition; // Incorporate the bundles as entity:$entity_type:$bundle, if any. reverted: --- b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php +++ a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php @@ -44,12 +44,9 @@ * @return static */ public static function createFromEntity(EntityInterface $entity) { + $definition = EntityDataDefinition::create() + ->setEntityTypeId($entity->getEntityTypeId()) + ->setBundles([$entity->bundle()]); - $entity_type_id = $entity->getEntityTypeId(); - $bundle = $entity->bundle(); - $definition = EntityDataDefinition::create( - $entity_type_id, - ($bundle !== $entity_type_id) ? $bundle : NULL - ); $instance = new static($definition); $instance->setValue($entity); return $instance; diff -u b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php --- b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php @@ -151,7 +151,7 @@ $entity_type = $this->prophesize(EntityTypeInterface::class); $entity_type->getLabel()->willReturn($this->randomString()); $entity_type->getConstraints()->willReturn([]); - $entity_type->getKey('internal')->willReturn($internal); + $entity_type->get('internal')->willReturn($internal); $entity_manager = $this->prophesize(EntityManagerInterface::class); $entity_manager->getDefinitions()->willReturn([$entity_type_id => $entity_type->reveal()]); reverted: --- b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php +++ a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php @@ -159,7 +159,7 @@ $this->typedDataManager = $this->getMock(TypedDataManagerInterface::class); $this->typedDataManager->expects($this->any()) ->method('getDefinition') + ->with('entity') - ->with("entity:{$this->entityTypeId}:{$this->bundle}") ->will($this->returnValue(['class' => '\Drupal\Core\Entity\Plugin\DataType\EntityAdapter'])); $this->typedDataManager->expects($this->any()) ->method('getDefaultConstraints')