function entity_load

7.x entity_load($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE)

Load entities from the database.

The entities are stored in a static memory cache, and will not require database access if loaded again during the same page request.

The actual loading is done through a class that has to implement the DrupalEntityControllerInterface interface. By default, DrupalDefaultEntityController is used. Entity types can specify that a different class should be used by setting the 'controller class' key in hook_entity_info(). These classes can either implement the DrupalEntityControllerInterface interface, or, most commonly, extend the DrupalDefaultEntityController class. See node_entity_info() and the NodeController in node.module as an example.

@todo Remove $conditions in Drupal 8.


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

$ids: An array of entity IDs, or FALSE to load all entities.

$conditions: (deprecated) An associative array of conditions on the base table, where the keys are the database fields and the values are the values those fields must have. Instead, it is preferable to use EntityFieldQuery to retrieve a list of entity IDs loadable by this function.

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

Return value

An array of entity objects indexed by their ids. When no results are found, an empty array is returned.

See also





7 calls to entity_load()
comment_load_multiple in drupal/modules/comment/comment.module
Load comments from the database.
file_file_download in drupal/modules/file/file.module
Implements hook_file_download().
file_load_multiple in drupal/includes/
Loads file objects from the database.
node_load_multiple in drupal/modules/node/node.module
Loads node entities from the database.
taxonomy_term_load_multiple in drupal/modules/taxonomy/taxonomy.module
Load multiple taxonomy terms based on certain conditions.

... See full list

1 string reference to 'entity_load'
DrupalDefaultEntityController::attachLoad in drupal/includes/
Attaches data to entities upon loading.


drupal/includes/, line 7734
Common functions that many Drupal modules will need to reference.


function entity_load($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) {
  if ($reset) {
  return entity_get_controller($entity_type)->load($ids, $conditions);