Drupal 8  8.0.2
EntityStorageInterface Interface Reference
Inheritance diagram for EntityStorageInterface:

Public Member Functions

 resetCache (array $ids=NULL)
 
 loadMultiple (array $ids=NULL)
 
 load ($id)
 
 loadUnchanged ($id)
 
 loadRevision ($revision_id)
 
 deleteRevision ($revision_id)
 
 loadByProperties (array $values=array())
 
 create (array $values=array())
 
 delete (array $entities)
 
 save (EntityInterface $entity)
 
 getQuery ($conjunction= 'AND')
 
 getAggregateQuery ($conjunction= 'AND')
 
 getEntityTypeId ()
 
 getEntityType ()
 

Data Fields

const FIELD_LOAD_CURRENT = 'FIELD_LOAD_CURRENT'
 
const FIELD_LOAD_REVISION = 'FIELD_LOAD_REVISION'
 

Detailed Description

Defines the interface for entity storage classes.

For common default implementations, see for content entities and for config entities. Those implementations are used by default when the or annotations are used.

Member Function Documentation

create ( array  $values = array())

Constructs a new entity object, without permanently saving it.

Parameters
array$values(optional) An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.
Returns
A new entity object.

Implemented in EntityStorageBase, and TermStorage.

Referenced by ConfigTest\postSave().

Here is the caller graph for this function:

delete ( array  $entities)

Deletes permanently saved entities.

Parameters
array$entitiesAn array of entity objects to delete.
Exceptions
\Drupal\Core\Entity\EntityStorageExceptionIn case of failures, an exception is thrown.

Implemented in SqlContentEntityStorage, EntityStorageBase, and ContentEntityNullStorage.

deleteRevision (   $revision_id)

Delete a specific entity revision.

A revision can only be deleted if it's not the currently active one.

Parameters
int$revision_idThe revision id.

Implemented in ConfigEntityStorage, KeyValueEntityStorage, and ContentEntityNullStorage.

getAggregateQuery (   $conjunction = 'AND')

Gets an aggregated query instance.

Parameters
string$conjunction(optional) The logical operator for the query, either:
  • AND: all of the conditions on the query need to match.
  • OR: at least one of the conditions on the query need to match.
Returns
The aggregated query object that can query the given entity type.
See Also
::getQueryServiceName()

Implemented in EntityStorageBase.

getEntityType ( )

Gets the entity type definition.

Returns
Entity type definition.

Implemented in EntityStorageBase.

Referenced by Entity\postDelete().

Here is the caller graph for this function:

getEntityTypeId ( )

Gets the entity type ID.

Returns
string The entity type ID.

Implemented in EntityStorageBase.

Referenced by EntityTest\preCreate().

Here is the caller graph for this function:

getQuery (   $conjunction = 'AND')

Gets an entity query instance.

Parameters
string$conjunction(optional) The logical operator for the query, either:
  • AND: all of the conditions on the query need to match.
  • OR: at least one of the conditions on the query need to match.
Returns
The query instance.
See Also
::getQueryServiceName()

Implemented in EntityStorageBase.

Referenced by ConfigEntityBase\preSave().

Here is the caller graph for this function:

load (   $id)

Loads one entity.

Parameters
mixed$idThe ID of the entity to load.
Returns
|null An entity object. NULL if no matching entity is found.

Implemented in EntityStorageBase, ContentEntityNullStorage, and EntityTestNoLoadStorage.

Referenced by ViewsBlockBase\__construct(), ConfigTest\postDelete(), and ConfigTest\postSave().

Here is the caller graph for this function:

loadByProperties ( array  $values = array())

Load entities by their property values.

Parameters
array$valuesAn associative array where the keys are the property names and the values are the values those properties must have.
Returns
[] An array of entity objects indexed by their ids.

Implemented in EntityStorageBase, FieldConfigStorage, and ContentEntityNullStorage.

loadMultiple ( array  $ids = NULL)

Loads one or more entities.

Parameters
$idsAn array of entity IDs, or NULL to load all entities.
Returns
[] An array of entity objects indexed by their IDs. Returns an empty array if no matching entities are found.

Implemented in EntityStorageBase, and ContentEntityNullStorage.

Referenced by Role\preSave().

Here is the caller graph for this function:

loadRevision (   $revision_id)

Load a specific entity revision.

Parameters
int | string$revision_idThe revision id.
Returns
|null The specified entity revision or NULL if not found.

Implemented in ContentEntityStorageBase, ConfigEntityStorage, KeyValueEntityStorage, and ContentEntityNullStorage.

loadUnchanged (   $id)

Loads an unchanged entity from the database.

Parameters
mixed$idThe ID of the entity to load.
Returns
|null The unchanged entity, or NULL if the entity cannot be loaded.
Todo:
Remove this method once we have a reliable way to retrieve the unchanged entity from the entity object.

Implemented in EntityStorageBase.

Referenced by ConfigEntityBase\preSave().

Here is the caller graph for this function:

resetCache ( array  $ids = NULL)

Resets the internal, static entity cache.

Parameters
$ids(optional) If specified, the cache is reset for the entities with the given ids only.

Implemented in ContentEntityStorageBase, EntityStorageBase, TermStorage, and VocabularyStorage.

Referenced by Vocabulary\postDelete().

Here is the caller graph for this function:

save ( EntityInterface  $entity)

Saves the entity permanently.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity to save.
Returns
SAVED_NEW or SAVED_UPDATED is returned depending on the operation performed.
Exceptions
\Drupal\Core\Entity\EntityStorageExceptionIn case of failures, an exception is thrown.

Implemented in SqlContentEntityStorage, EntityStorageBase, ConfigEntityStorage, KeyValueEntityStorage, and ContentEntityNullStorage.

Field Documentation

const FIELD_LOAD_CURRENT = 'FIELD_LOAD_CURRENT'

Load the most recent version of an entity's field data.

const FIELD_LOAD_REVISION = 'FIELD_LOAD_REVISION'

Load the version of an entity's field data specified in the entity.

Referenced by FileAccessControlHandler\getFileReferences().


The documentation for this interface was generated from the following file: