function entity_load_unchanged
Same name in other branches
- 8.9.x core/includes/entity.inc \entity_load_unchanged()
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.
7 calls to entity_load_unchanged()
- comment_save in modules/
comment/ comment.module - Accepts a submission of new or changed comment content.
- file_save in includes/
file.inc - Saves a file object to the database.
- node_save in modules/
node/ node.module - Saves changes to a node or adds a new node.
- taxonomy_term_save in modules/
taxonomy/ taxonomy.module - Saves a term object to the database.
- taxonomy_vocabulary_save in modules/
taxonomy/ taxonomy.module - Saves a vocabulary.
File
-
includes/
common.inc, line 8232
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.