function SqlContentEntityStorage::deleteRevisionFromDedicatedTables

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::deleteRevisionFromDedicatedTables()
  2. 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::deleteRevisionFromDedicatedTables()
  3. 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::deleteRevisionFromDedicatedTables()

Deletes values of fields in dedicated tables for all revisions.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity. It must have a revision ID.

1 call to SqlContentEntityStorage::deleteRevisionFromDedicatedTables()
SqlContentEntityStorage::doDeleteRevisionFieldItems in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Deletes field values of an entity revision from the storage.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 1435

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

protected function deleteRevisionFromDedicatedTables(ContentEntityInterface $entity) {
    $vid = $entity->getRevisionId();
    if (isset($vid)) {
        $table_mapping = $this->getTableMapping();
        foreach ($this->fieldStorageDefinitions as $storage_definition) {
            if (!$table_mapping->requiresDedicatedTableStorage($storage_definition)) {
                continue;
            }
            $revision_name = $table_mapping->getDedicatedRevisionTableName($storage_definition);
            $this->database
                ->delete($revision_name)
                ->condition('entity_id', $entity->id())
                ->condition('revision_id', $vid)
                ->execute();
        }
    }
}

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