Skip navigation
Help

entity_load_unchanged

7 common.inc entity_load_unchanged($entity_type, $id)

Loads the unchanged, i.e. not modified, entity from the database.

Unlike entity_load() this function ensures the entity is directly loaded from the database, thus bypassing any static cache. In particular, this function is useful to determine changes by comparing the entity being saved to the stored entity.

Parameters

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

$id: The id of the entity to load.

Return value

The unchanged entity, or FALSE if the entity cannot be loaded.

6 calls to entity_load_unchanged()

File

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

Code

function entity_load_unchanged($entity_type, $id) {
  entity_get_controller($entity_type)->resetCache(array($id));
  $result = entity_get_controller($entity_type)->load(array($id));
  return reset($result);
}