// If 'progress' is not set, then this will be the first run of the batch.
if (!
isset($sandbox['progress'
])) { // We cannot support updating the schema of an entity type from
// revisionable to non-revisionable or translatable to non-translatable
// because that can lead to unintended data loss.
// @todo Add support for these conversions in case there is no data loss.
// @see https://www.drupal.org/project/drupal/issues/3024727
$convert_rev_to_non_rev =
$original->
isRevisionable() && !
$entity_type->
isRevisionable();
$convert_mul_to_non_mul =
$original->
isTranslatable() && !
$entity_type->
isTranslatable();
if ($has_data && ($convert_rev_to_non_rev ||
$convert_mul_to_non_mul)) { throw new EntityStorageException('Converting an entity type from revisionable to non-revisionable or from translatable to non-translatable is not supported.'
);
} // Check that the fields required by a revisionable entity type exist.
if ($entity_type->
isRevisionable() && !
isset($field_storage_definitions[$entity_type->
getKey('revision'
)])) { throw new EntityStorageException('Missing revision field.'
);
} if ($entity_type->
isRevisionable() && !
isset($field_storage_definitions[$entity_type->
getRevisionMetadataKey('revision_default'
)])) { throw new EntityStorageException('Missing revision_default field.'
);
} // Check that the fields required by a translatable entity type exist.