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.
\Drupal::entityTypeManager()->getStorage($entity_type)->loadUnchanged($id);
$entity_type: The entity type to load, e.g. node or user.
$id: The ID of the entity to load.
\Drupal\Core\Entity\EntityInterface|null The unchanged entity, or FALSE if the entity cannot be loaded.
as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use the entity storage's loadUnchanged() method to load an unchanged entity:
\Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
\Drupal\Core\Entity\EntityStorageInterface::loadUnchanged()
function entity_load_unchanged($entity_type, $id) { return \Drupal::entityManager() ->getStorage($entity_type) ->loadUnchanged($id); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!entity.inc/function/entity_load_unchanged/8.1.x