EntityStorageInterface
interface EntityStorageInterface (View source)
Defines the interface for entity storage classes.
For common default implementations, see \Drupal\Core\Entity\Sql\SqlContentEntityStorage for content entities and \Drupal\Core\Config\Entity\ConfigEntityStorage for config entities. Those implementations are used by default when the @ContentEntityType or
Constants
| FIELD_LOAD_CURRENT |
Load the most recent version of an entity's field data. |
| FIELD_LOAD_REVISION |
Load the version of an entity's field data specified in the entity. |
Methods
Resets the internal entity cache.
Loads one or more entities.
Loads one entity.
Loads an unchanged entity from the database.
Load a specific entity revision.
Delete a specific entity revision.
Load entities by their property values.
Constructs a new entity object, without permanently saving it.
Deletes permanently saved entities.
Determines if the storage contains any data.
Gets an entity query instance.
Gets an aggregated query instance.
Gets the entity type ID.
Gets the entity type definition.
Retrieves the class name used to create the entity.
Details
resetCache(array $ids = NULL)
Resets the internal 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.
string
getEntityClass(string|null $bundle = NULL)
Retrieves the class name used to create the entity.