function ContentEntityStorageBase::deleteRevision

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::deleteRevision()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::deleteRevision()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::deleteRevision()

Overrides EntityStorageInterface::deleteRevision

1 method overrides ContentEntityStorageBase::deleteRevision()
ContentEntityNullStorage::deleteRevision in core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
Delete a specific entity revision.

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 812

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

public function deleteRevision($revision_id) {
    
    /** @var \Drupal\Core\Entity\ContentEntityInterface $revision */
    if ($revision = $this->loadRevision($revision_id)) {
        // Prevent deletion if this is the default revision.
        if ($revision->isDefaultRevision()) {
            throw new EntityStorageException('Default revision can not be deleted');
        }
        $this->invokeFieldMethod('deleteRevision', $revision);
        $this->doDeleteRevisionFieldItems($revision);
        $this->invokeHook('revision_delete', $revision);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.