function entity_load
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.
Parameters
$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
DrupalEntityControllerInterface
7 calls to entity_load()
- comment_load_multiple in drupal-7.x/
modules/ comment/ comment.module - Load comments from the database.
- file_file_download in drupal-7.x/
modules/ file/ file.module - Implements hook_file_download().
- file_load_multiple in drupal-7.x/
includes/ file.inc - Loads file objects from the database.
- node_load_multiple in drupal-7.x/
modules/ node/ node.module - Loads node entities from the database.
- taxonomy_term_load_multiple in drupal-7.x/
modules/ taxonomy/ taxonomy.module - Load multiple taxonomy terms based on certain conditions.
1 string reference to 'entity_load'
- DrupalDefaultEntityController::attachLoad in drupal-7.x/
includes/ entity.inc - Attaches data to entities upon loading.
Archivo
- drupal-7.x/
includes/ common.inc, line 7776 - Common functions that many Drupal modules will need to reference.
Código
function entity_load($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);
}