You are here

function entity_modified_last_id in Entity modified 7

Retrieve the last time an entity was modified - using an ID.

Parameters

$entity_type: The entity type of the entity.

$entity_id: The entity id of the entity.

Return value

timestamp Returns the last modified timestamp for the given entity_type, entity_id.

File

./entity_modified.module, line 93
Hook implementations and frequently used functions for entity modified module.

Code

function entity_modified_last_id($entity_type, $entity_id) {
  $modified_timestamp = db_query('SELECT modified FROM {entity_modified} WHERE entity_type = :entity_type AND entity_id = :entity_id', array(
    ':entity_type' => $entity_type,
    ':entity_id' => $entity_id,
  ))
    ->fetchField();

  // If not found then use '1' as inserting something in a read-only operation
  // is a bad idea.
  if (!$modified_timestamp) {
    $modified_timestamp = 1;
  }
  return $modified_timestamp;
}