diff --git a/core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php index 0a2b9f3..00c23b7 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php @@ -27,6 +27,11 @@ public function onEntityTypeCreate(EntityTypeInterface $entity_type); * The updated entity type definition. * @param \Drupal\Core\Entity\EntityTypeInterface $original * The original entity type definition. + * + * @return int|NULL + * Returns EntityDefinitionUpdateManager::DEFINITION_UPDATED if the storage + * was updated, EntityDefinitionUpdateManager::DEFINITION_RECREATED if it + * was deleted and recreated or NULL if no action was taken. */ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original); diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 5d01610..3d13d7d 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -313,6 +313,7 @@ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeI // Store the updated entity schema. $this->saveEntitySchemaData($entity_type, $entity_schema); } + return EntityDefinitionUpdateManager::DEFINITION_UPDATED; } /** diff --git a/core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php b/core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php index 49bcd86..d76af6b 100644 --- a/core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php +++ b/core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php @@ -483,8 +483,9 @@ public function testDefinitionEvents() { public function testEntityTypeSchemaUpdateAndBaseFieldCreateWithoutData() { $this->updateEntityTypeToRevisionable(); $this->addBaseField(); - // The base field will be created as part of the entity type update and should not throw an exception when being - // created again as part of the field update. + // The base field will be created as part of the entity type update and + // should not throw an exception when being created again as part of the + // field update. try { $this->entityDefinitionUpdateManager->applyUpdates(); $this->pass('Successfully updated entity schema and created base field at the same time.');