DynamicallyFieldableEntityStorageInterface
interface DynamicallyFieldableEntityStorageInterface implements FieldableEntityStorageInterface, FieldStorageDefinitionListenerInterface, FieldDefinitionListenerInterface (View source)
A storage that supports entity types with dynamic field definitions.
A storage that implements this interface can react to the entity type's field definitions changing, due to modules being installed or uninstalled, or via field UI, or via code changes to the entity class.
For example, configurable fields defined and exposed by field.module.
Methods
Loads one or more entities.
Loads an unchanged entity from the database.
Load a specific entity revision.
Load entities by their property values.
Constructs a new entity object, without permanently saving it.
Gets an entity query instance.
Gets an aggregated query instance.
Determines the number of entities with values for a given field.
Purges a batch of field data.
Performs final cleanup after all data of a field has been purged.
Reacts to the creation of a field storage definition.
Reacts to the update of a field storage definition.
Reacts to the deletion of a field storage definition.
Reacts to the creation of a field.
Reacts to the update of a field.
Reacts to the deletion of a field.
Details
resetCache(array $ids = NULL)
Resets the internal, static entity cache.
EntityInterface[]
loadMultiple(array $ids = NULL)
Loads one or more entities.
EntityInterface|null
load(mixed $id)
Loads one entity.
EntityInterface|null
loadUnchanged(mixed $id)
Loads an unchanged entity from the database.
EntityInterface|null
loadRevision(int|string $revision_id)
Load a specific entity revision.
deleteRevision(int $revision_id)
Delete a specific entity revision.
A revision can only be deleted if it's not the currently active one.
EntityInterface[]
loadByProperties(array $values = [])
Load entities by their property values.
EntityInterface
create(array $values = [])
Constructs a new entity object, without permanently saving it.
delete(array $entities)
Deletes permanently saved entities.
SAVED_NEW
save(EntityInterface $entity)
Saves the entity permanently.
restore(EntityInterface $entity)
| internal | This method should never be used to perform a regular entity save. Its only use-case is to assist updating entity types when there are complex schema changes, for example, to make them revisionable. Note that overriding this method to fix data prior to restoring is a likely sign that the current data is corrupt. |
Restores a previously saved entity.
Note that the entity is assumed to be in a valid state for the storage, so the restore process does not invoke any hooks, nor does it perform any pre or post-save operations.
bool
hasData()
Determines if the storage contains any data.
QueryInterface
getQuery(string $conjunction = 'AND')
Gets an entity query instance.
QueryAggregateInterface
getAggregateQuery(string $conjunction = 'AND')
Gets an aggregated query instance.
string
getEntityTypeId()
Gets the entity type ID.
EntityTypeInterface
getEntityType()
Gets the entity type definition.
bool|int
countFieldData(FieldStorageDefinitionInterface $storage_definition, bool $as_bool = FALSE)
Determines the number of entities with values for a given field.
int
purgeFieldData(FieldDefinitionInterface $field_definition, int $batch_size)
Purges a batch of field data.
finalizePurge(FieldStorageDefinitionInterface $storage_definition)
Performs final cleanup after all data of a field has been purged.
onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition)
Reacts to the creation of a field storage definition.
onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original)
Reacts to the update of a field storage definition.
onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition)
Reacts to the deletion of a field storage definition.
onFieldDefinitionCreate(FieldDefinitionInterface $field_definition)
Reacts to the creation of a field.
onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original)
Reacts to the update of a field.
onFieldDefinitionDelete(FieldDefinitionInterface $field_definition)
Reacts to the deletion of a field.
Stored values should not be wiped at once, but marked as 'deleted' so that they can go through a proper purge process later on.