EntityDefinitionUpdateManager
class EntityDefinitionUpdateManager implements EntityDefinitionUpdateManagerInterface (View source)
Manages entity definition updates.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected EntityFieldManagerInterface | $entityFieldManager | The entity field manager service. |
|
| protected EntityTypeListenerInterface | $entityTypeListener | The entity type listener service. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager service. |
|
| protected FieldStorageDefinitionListenerInterface | $fieldStorageDefinitionListener | The field storage definition listener service. |
|
| protected EntityLastInstalledSchemaRepositoryInterface | $entityLastInstalledSchemaRepository | The last installed schema repository. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Constructs a new EntityDefinitionUpdateManager.
Checks if there are any definition updates that need to be applied.
Gets a human readable summary of the detected changes.
Returns an entity type definition ready to be manipulated.
Returns all the entity type definitions, ready to be manipulated.
Applies any change performed to the passed entity type definition.
Installs a new fieldable entity type definition.
Applies any change performed to a fieldable entity type definition.
Installs a new field storage definition.
Returns a field storage definition ready to be manipulated.
Applies any change performed to the passed field storage definition.
Uninstalls a field storage definition.
Gets a list of changes to entity type and field storage definitions.
Checks if the changes to the entity type requires storage schema changes.
Checks if the changes to the storage definition requires schema changes.
Checks if existing data would be lost if the schema changes were applied.
Clears necessary caches to apply entity/field definition updates.
Details
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__construct(EntityTypeManagerInterface $entity_type_manager, EntityLastInstalledSchemaRepositoryInterface $entity_last_installed_schema_repository, EntityFieldManagerInterface $entity_field_manager, EntityTypeListenerInterface $entity_type_listener, FieldStorageDefinitionListenerInterface $field_storage_definition_listener)
Constructs a new EntityDefinitionUpdateManager.
bool
needsUpdates()
Checks if there are any definition updates that need to be applied.
array
getChangeSummary()
Gets a human readable summary of the detected changes.
EntityTypeInterface|null
getEntityType(string $entity_type_id)
Returns an entity type definition ready to be manipulated.
When needing to apply updates to existing entity type definitions, this method should always be used to retrieve a definition ready to be manipulated.
EntityTypeInterface[]
getEntityTypes()
Returns all the entity type definitions, ready to be manipulated.
When needing to apply updates to existing entity type definitions, this method should always be used to retrieve all the definitions ready to be manipulated.
installEntityType(EntityTypeInterface $entity_type)
Installs a new entity type definition.
updateEntityType(EntityTypeInterface $entity_type)
Applies any change performed to the passed entity type definition.
uninstallEntityType(EntityTypeInterface $entity_type)
Uninstalls an entity type definition.
installFieldableEntityType(EntityTypeInterface $entity_type, array $field_storage_definitions)
Installs a new fieldable entity type definition.
updateFieldableEntityType(EntityTypeInterface $entity_type, array $field_storage_definitions, array $sandbox = NULL)
Applies any change performed to a fieldable entity type definition.
installFieldStorageDefinition(string $name, string $entity_type_id, string $provider, FieldStorageDefinitionInterface $storage_definition)
Installs a new field storage definition.
FieldStorageDefinitionInterface
getFieldStorageDefinition(string $name, string $entity_type_id)
Returns a field storage definition ready to be manipulated.
When needing to apply updates to existing field storage definitions, this method should always be used to retrieve a storage definition ready to be manipulated.
updateFieldStorageDefinition(FieldStorageDefinitionInterface $storage_definition)
Applies any change performed to the passed field storage definition.
uninstallFieldStorageDefinition(FieldStorageDefinitionInterface $storage_definition)
Uninstalls a field storage definition.
array
getChangeList()
Gets a list of changes to entity type and field storage definitions.
protected bool
requiresEntityStorageSchemaChanges(EntityTypeInterface $entity_type, EntityTypeInterface $original)
Checks if the changes to the entity type requires storage schema changes.
protected bool
requiresFieldStorageSchemaChanges(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original)
Checks if the changes to the storage definition requires schema changes.
protected bool
requiresEntityDataMigration(EntityTypeInterface $entity_type, EntityTypeInterface $original)
Checks if existing data would be lost if the schema changes were applied.
protected
clearCachedDefinitions()
Clears necessary caches to apply entity/field definition updates.