1 entity.module entity_load_multiple($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE)

Loads entities from the database.

This function should be used whenever you need to load more than one entity from the database. The entities are loaded into memory 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 EntityControllerInterface interface. By default, DefaultEntityController 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 EntityControllerInterface interface, or, most commonly, extend the DefaultEntityController class. See node_entity_info() and the NodeController in node.module as an example.

Parameters

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

$ids: An array of entity IDs, FALSE with no conditions to load all entities of the requested entity type, or NULL with conditions to load all entities of the requested entity type that meet the given conditions.

$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

array: An array of entity objects indexed by their ids.

See also

hook_entity_info()

EntityControllerInterface

DefaultEntityController

EntityFieldQuery

File

core/modules/entity/entity.module, line 434
Entity API for handling entities like nodes or users.

Code

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