SqlContentEntityStorageSchemaConverter deprecated
class SqlContentEntityStorageSchemaConverter (View source)
deprecated
Defines a schema converter for entity types with existing data.
Properties
| protected string | $entityTypeId | The entity type ID this schema converter is responsible for. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
|
| protected EntityDefinitionUpdateManagerInterface | $entityDefinitionUpdateManager | The entity definition update manager service. |
Methods
__construct(string $entity_type_id, EntityTypeManagerInterface $entity_type_manager, EntityDefinitionUpdateManagerInterface $entity_definition_update_manager)
SqlContentEntityStorageSchemaConverter constructor.
convertToRevisionable(array $sandbox, array $fields_to_update = [])
Converts an entity type with existing data to be revisionable.
Details
__construct(string $entity_type_id, EntityTypeManagerInterface $entity_type_manager, EntityDefinitionUpdateManagerInterface $entity_definition_update_manager)
SqlContentEntityStorageSchemaConverter constructor.
convertToRevisionable(array $sandbox, array $fields_to_update = [])
Converts an entity type with existing data to be revisionable.
This process does the following tasks:
- creates the schema from scratch with the new revisionable entity type definition (i.e. the current definition of the entity type from code) using temporary table names;
- loads the initial entity data by using the last installed entity and field storage definitions;
- saves the entity data to the temporary tables;
- at the end of the process:
- deletes the original tables and replaces them with the temporary ones that hold the new (revisionable) entity data;
- updates the installed entity schema data;
- updates the entity type definition in order to trigger the \Drupal\Core\Entity\EntityTypeEvents::UPDATE event;
- updates the field storage definitions in order to mark the revisionable ones as such.
In case of an error during the entity save process, the temporary tables are deleted and the original entity type and field storage definitions are restored.