function SqlContentEntityStorageSchema::requiresEntityDataMigration

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::requiresEntityDataMigration()
  2. 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::requiresEntityDataMigration()
  3. 11.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::requiresEntityDataMigration()

Overrides EntityStorageSchemaInterface::requiresEntityDataMigration

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 322

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

public function requiresEntityDataMigration(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
    // If the original storage has existing entities, or it is impossible to
    // determine if that is the case, require entity data to be migrated.
    $original_storage_class = $original->getStorageClass();
    if (!class_exists($original_storage_class)) {
        return TRUE;
    }
    // Data migration is not needed when only indexes changed, as they can be
    // applied if there is data.
    if (!$this->hasSharedTableStructureChange($entity_type, $original)) {
        return FALSE;
    }
    return $this->storage
        ->hasData();
}

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