entity_revision_load

entity_revision_load($entity_type, $revision_id)

Loads an entity from the database.

\Drupal::entityTypeManager()
  ->getStorage($entity_type)
  ->loadRevision($revision_id);

Parameters

string $entity_type: The entity type to load, e.g. node or user.

int $revision_id: The id of the entity to load.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity object, or NULL if there is no entity with the given revision id.

Deprecated

as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use the entity storage's loadRevision() method to load a specific entity revision:

See also

\Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()

\Drupal\Core\Entity\EntityStorageInterface::loadRevision()

\Drupal\Core\Entity\Sql\SqlContentEntityStorage

File

core/includes/entity.inc, line 113
Entity API for handling entities like nodes or users.

Code

function entity_revision_load($entity_type, $revision_id) {
  return \Drupal::entityManager()
    ->getStorage($entity_type)
    ->loadRevision($revision_id);
}
doc_Drupal
2016-10-29 09:09:16
Comments
Leave a Comment

Please login to continue.