Typically entities - at least Nodes - will include an "original" property. This contains the unchanged entity loaded directly from the database, see entity_load_unchanged()
Here's what the Node module does on node_save()
<?php
// Load the stored entity, if any.
if (!empty($node->nid) && !isset($node->original)) {
$node->original = entity_load_unchanged('node', $node->nid);
}
field_attach_presave('node', $node);
global $user;
// Determine if we will be inserting a new node.
if (!isset($node->is_new)) {
$node->is_new = empty($node->nid);
}
?>
Patch incoming to replicate this process.
Comments
Comment #1
mglamanPatch attached. This would be a huge feature. Even though it may not seem like much, but it provides a method for tracking changes made between saves.
Comment #2
mglamanFixing patch, copy paste fail :/
Comment #3
damienmckennaComment #5
damienmckennaCommitted. Thanks Matt!