function EntityOperations::entityRevisionDelete

Same name in this branch
  1. 11.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityRevisionDelete()
Same name and namespace in other branches
  1. 9 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityRevisionDelete()
  2. 8.9.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityRevisionDelete()
  3. 10 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityRevisionDelete()

Implements hook_entity_revision_delete().

Attributes

#[Hook('entity_revision_delete')]

File

core/modules/workspaces/src/Hook/EntityOperations.php, line 262

Class

EntityOperations
Defines a class for reacting to entity runtime hooks.

Namespace

Drupal\workspaces\Hook

Code

public function entityRevisionDelete(EntityInterface $entity) : void {
  if ($this->workspaceInfo
    ->isEntityTypeSupported($entity->getEntityType())) {
    $this->workspaceAssociation
      ->deleteAssociations(NULL, $entity->getEntityTypeId(), [
      $entity->id(),
    ], [
      $entity->getRevisionId(),
    ]);
  }
}

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