Defines an interface for managing entity definition updates.
During the application lifetime, the definitions of various entity types and their data components (e.g., fields for fieldable entity types) can change. For example, updated code can be deployed. Some entity handlers may need to perform complex or long-running logic in response to the change. For example, a SQL-based storage handler may need to update the database schema.
To support this, \Drupal\Core\Entity\EntityManagerInterface has methods to retrieve the last installed definitions as well as the definitions specified by the current codebase. It also has create/update/delete methods to bring the former up to date with the latter.
However, it is not the responsibility of the entity manager to decide how to report the differences or when to apply each update. This interface is for managing that.
This interface also provides methods to retrieve instances of the definitions to be updated ready to be manipulated. In fact when definitions change in code the system needs to be notified about that and the definitions stored in state need to be reconciled with the ones living in code. This typically happens in Update API functions, which need to take the system from a known state to another known state. Relying on the definitions living in code might prevent this, as the system might transition directly to the last available state, and thus skipping the intermediate steps. Manipulating the definitions in state allows to avoid this and ensures that the various steps of the update process are predictable and repeatable.
Hierarchy
- interface \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface
See also
\Drupal\Core\Entity\EntityManagerInterface::getDefinition()
\Drupal\Core\Entity\EntityManagerInterface::getLastInstalledDefinition()
\Drupal\Core\Entity\EntityManagerInterface::getFieldStorageDefinitions()
\Drupal\Core\Entity\EntityManagerInterface::getLastInstalledFieldStorageDefinitions()
File
- core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php, line 42
Namespace
Drupal\Core\Entity
Members
Name | Modifiers | Type | Description |
---|---|---|---|
EntityDefinitionUpdateManagerInterface::applyUpdates | public | function | Applies all the detected valid changes. |
EntityDefinitionUpdateManagerInterface::DEFINITION_CREATED | constant | Indicates that a definition has just been created. | |
EntityDefinitionUpdateManagerInterface::DEFINITION_DELETED | constant | Indicates that a definition has just been deleted. | |
EntityDefinitionUpdateManagerInterface::DEFINITION_UPDATED | constant | Indicates that a definition has changes. | |
EntityDefinitionUpdateManagerInterface::getChangeSummary | public | function | Gets a human readable summary of the detected changes. |
EntityDefinitionUpdateManagerInterface::getEntityType | public | function | Returns an entity type definition ready to be manipulated. |
EntityDefinitionUpdateManagerInterface::getFieldStorageDefinition | public | function | Returns a field storage definition ready to be manipulated. |
EntityDefinitionUpdateManagerInterface::installEntityType | public | function | Installs a new entity type definition. |
EntityDefinitionUpdateManagerInterface::installFieldStorageDefinition | public | function | Installs a new field storage definition. |
EntityDefinitionUpdateManagerInterface::needsUpdates | public | function | Checks if there are any definition updates that need to be applied. |
EntityDefinitionUpdateManagerInterface::uninstallEntityType | public | function | Uninstalls an entity type definition. |
EntityDefinitionUpdateManagerInterface::uninstallFieldStorageDefinition | public | function | Uninstalls a field storage definition. |
EntityDefinitionUpdateManagerInterface::updateEntityType | public | function | Applies any change performed to the passed entity type definition. |
EntityDefinitionUpdateManagerInterface::updateFieldStorageDefinition | public | function | Applies any change performed to the passed field storage definition. |
Please login to continue.