function EntityOperations::entityDelete

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

Implements hook_entity_delete().

Attributes

#[Hook('entity_delete')]

File

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

Class

EntityOperations
Defines a class for reacting to entity runtime hooks.

Namespace

Drupal\workspaces\Hook

Code

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

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