function EntityDefinitionUpdateManager::requiresEntityDataMigration

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php \Drupal\Core\Entity\EntityDefinitionUpdateManager::requiresEntityDataMigration()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php \Drupal\Core\Entity\EntityDefinitionUpdateManager::requiresEntityDataMigration()
  3. 10 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.