EntityLastInstalledSchemaRepository
class EntityLastInstalledSchemaRepository implements EntityLastInstalledSchemaRepositoryInterface (View source)
Provides a repository for installed entity definitions.
Properties
| protected KeyValueFactoryInterface | $keyValueFactory | The key-value factory. |
|
| protected CacheBackendInterface | $cacheBackend | The cache backend. |
|
| protected array|null | $entityTypeDefinitions | The loaded installed entity type definitions. |
Methods
Constructs a new EntityLastInstalledSchemaRepository.
Gets the entity type definition in its most recently installed state.
Gets the entity type definitions in their most recently installed state.
Stores the entity type definition in the application state.
Deletes the entity type definition from the application state.
Gets the entity type's most recently installed field storage definitions.
Stores the entity type's field storage definitions in the application state.
Stores the field storage definition in the application state.
Deletes the field storage definition from the application state.
Details
__construct(KeyValueFactoryInterface $key_value_factory, CacheBackendInterface $cache = NULL)
Constructs a new EntityLastInstalledSchemaRepository.
EntityTypeInterface|null
getLastInstalledDefinition(string $entity_type_id)
Gets the entity type definition in its most recently installed state.
During the application lifetime, entity type definitions can change. For example, updated code can be deployed. The getDefinition() method will always return the definition as determined by the current codebase. This method, however, returns what the definition was when the last time that one of the \Drupal\Core\Entity\EntityTypeListenerInterface events was last fired and completed successfully. In other words, the definition that the entity type's handlers have incorporated into the application state. For example, if the entity type's storage handler is SQL-based, the definition for which database tables were created.
Application management code can check if getDefinition() differs from getLastInstalledDefinition() and decide whether to:
- Invoke the appropriate \Drupal\Core\Entity\EntityTypeListenerInterface event so that handlers react to the new definition.
- Raise a warning that the application state is incompatible with the codebase.
- Perform some other action.
EntityTypeInterface[]
getLastInstalledDefinitions()
Gets the entity type definitions in their most recently installed state.
During the application lifetime, entity type definitions can change. For example, updated code can be deployed. The \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinitions() method will always return the definitions as determined by the current codebase. This method returns the definitions from the last time that a \Drupal\Core\Entity\EntityTypeListener event was completed. In other words, the definitions that the entity type's handlers have incorporated into the application state. For example, if the entity type's storage handler is SQL-based, the definition for which database tables were created.
Application management code can check if \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinitions() differs from getLastInstalledDefinitions() and decide whether to:
- Invoke the appropriate \Drupal\Core\Entity\EntityTypeListenerInterface event so that handlers react to the new definitions.
- Raise a warning that the application state is incompatible with the codebase.
- Perform some other action.
$this
setLastInstalledDefinition(EntityTypeInterface $entity_type)
Stores the entity type definition in the application state.
$this
deleteLastInstalledDefinition(string $entity_type_id)
Deletes the entity type definition from the application state.
FieldStorageDefinitionInterface[]
getLastInstalledFieldStorageDefinitions(string $entity_type_id)
Gets the entity type's most recently installed field storage definitions.
During the application lifetime, field storage definitions can change. For example, updated code can be deployed. The getFieldStorageDefinitions() method will always return the definitions as determined by the current codebase. This method, however, returns what the definitions were when the last time that one of the \Drupal\Core\Field\FieldStorageDefinitionListenerInterface events was last fired and completed successfully. In other words, the definitions that the entity type's handlers have incorporated into the application state. For example, if the entity type's storage handler is SQL-based, the definitions for which database tables were created.
Application management code can check if getFieldStorageDefinitions() differs from getLastInstalledFieldStorageDefinitions() and decide whether to:
- Invoke the appropriate \Drupal\Core\Field\FieldStorageDefinitionListenerInterface events so that handlers react to the new definitions.
- Raise a warning that the application state is incompatible with the codebase.
- Perform some other action.
setLastInstalledFieldStorageDefinitions(string $entity_type_id, array $storage_definitions)
Stores the entity type's field storage definitions in the application state.
setLastInstalledFieldStorageDefinition(FieldStorageDefinitionInterface $storage_definition)
Stores the field storage definition in the application state.
deleteLastInstalledFieldStorageDefinition(FieldStorageDefinitionInterface $storage_definition)
Deletes the field storage definition from the application state.