By timmillwood on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.4.x
Introduced in version:
8.4.0-beta1
Issue links:
Description:
Before Drupal 8.4, there were only two revisionable entity types in core: Node and BlockContent. To work towards making more entity types revisionable the SqlContentEntityStorageSchemaConverter utility/helper class has been added.
In order to enable revision support for an entity type with existing data, the following post update function can be used as an example:
function <module_name>_post_update_make_revisionable(&$sandbox) {
$revisionableSchemaConverter = new SqlContentEntityStorageSchemaConverter(
'<entity_type_name>',
\Drupal::entityTypeManager(),
\Drupal::entityDefinitionUpdateManager(),
\Drupal::service('entity.last_installed_schema.repository'),
\Drupal::keyValue('entity.storage_schema.sql'),
\Drupal::database()
);
$revisionableSchemaConverter->convertToRevisionable(
$sandbox,
[
'<field_name_that_is_now_revisionable>',
...
]);
}
More detailed documentation about the upgrade path can be found here: https://www.drupal.org/docs/8/api/entity-api/converting-a-content-entity...
Impacts:
Module developers