function 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.

3 calls to entity_load_unchanged()
DatabaseStorageController::save in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageController.php
Implements Drupal\Core\Entity\EntityStorageControllerInterface::save().
DatabaseStorageControllerNG::save in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
Overrides DatabaseStorageController::save().
ImageAdminStylesTest::testStyle in drupal/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
General test to add a style, add/remove/edit effects to it, then delete it.

File

drupal/core/includes/entity.inc, line 234
Entity API for handling entities like nodes or users.

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);
}