function entity_load

Loads an entity from the database.

Parameters

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

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

bool $reset: Whether to reset the internal cache for the requested entity type.

Return value

Drupal\Core\Entity\EntityInterface The entity object, or FALSE if there is no entity with the given id.

See also

\Drupal\Core\Entity\EntityManager

entity_load_multiple()

Drupal\Core\Entity\EntityStorageControllerInterface

Drupal\Core\Entity\DatabaseStorageController

Drupal\Core\Entity\Query\QueryInterface

55 calls to entity_load()

File

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

Code

function entity_load($entity_type, $id, $reset = FALSE) {
  $entities = entity_load_multiple($entity_type, array(
    $id,
  ), $reset);
  return isset($entities[$id]) ? $entities[$id] : FALSE;
}