You are here

protected function EntityDefinitionUpdateManager::requiresEntityDataMigration in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php \Drupal\Core\Entity\EntityDefinitionUpdateManager::requiresEntityDataMigration()

Checks if existing data would be lost if the schema changes were applied.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The updated entity type definition.

\Drupal\Core\Entity\EntityTypeInterface $original: The original entity type definition.

Return value

bool TRUE if data migration is required, FALSE otherwise.

1 call to EntityDefinitionUpdateManager::requiresEntityDataMigration()
EntityDefinitionUpdateManager::updateFieldableEntityType in core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php
Applies any change performed to a fieldable entity type definition.

File

core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php, line 354

Class

EntityDefinitionUpdateManager
Manages entity definition updates.

Namespace

Drupal\Core\Entity

Code

protected function requiresEntityDataMigration(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
  $storage = $this->entityTypeManager
    ->getStorage($entity_type
    ->id());
  return $storage instanceof EntityStorageSchemaInterface && $storage
    ->requiresEntityDataMigration($entity_type, $original);
}