$revisionable_fields =
array_keys(array_filter($shared_table_definitions,
function DFieldStorageDefinitionInterface
$definition) { return $definition->
isRevisionable();
}));
// Make sure the key fields come first in the list of fields.
$all_fields =
array_merge($key_fields,
array_diff($all_fields,
$key_fields));
$revision_metadata_fields =
$revisionable ?
array_values($entity_type->
getRevisionMetadataKeys()) :
[];
$revision_metadata_fields =
array_intersect($revision_metadata_fields,
array_keys($storage_definitions));
if (!
$revisionable && !
$translatable) { // The base layout stores all the base field values in the base table.
$table_mapping->
setFieldNames($table_mapping->baseTable,
$all_fields);
} elseif ($revisionable && !
$translatable) { // The revisionable layout stores all the base field values in the base
// table, except for revision metadata fields. Revisionable fields
// denormalized in the base table but also stored in the revision table
// together with the entity ID and the revision ID as identifiers.
$table_mapping->
setFieldNames($table_mapping->baseTable,
array_diff($all_fields,
$revision_metadata_fields));
$revision_key_fields =
[$id_key,
$revision_key];
$table_mapping->
setFieldNames($table_mapping->revisionTable,
array_merge($revision_key_fields,
$revisionable_fields));
} elseif (!
$revisionable &&
$translatable) {