You are here

public function EntityAPIController::deleteRevision in Entity API 7

Implements EntityAPIControllerRevisionableInterface::deleteRevision().

Overrides EntityAPIControllerRevisionableInterface::deleteRevision

File

includes/entity.controller.inc, line 416
Provides a controller building upon the core controller but providing more features like full CRUD functionality.

Class

EntityAPIController
A controller implementing EntityAPIControllerInterface for the database.

Code

public function deleteRevision($revision_id) {
  if ($entity_revision = entity_revision_load($this->entityType, $revision_id)) {

    // Prevent deleting the default revision.
    if (entity_revision_is_default($this->entityType, $entity_revision)) {
      return FALSE;
    }
    db_delete($this->revisionTable)
      ->condition($this->revisionKey, $revision_id)
      ->execute();
    $this
      ->invoke('revision_delete', $entity_revision);
    return TRUE;
  }
  return FALSE;
}