You are here

function entity_legal_user_delete in Entity Legal 8.2

Same name and namespace in other branches
  1. 4.0.x entity_legal.module \entity_legal_user_delete()
  2. 3.0.x entity_legal.module \entity_legal_user_delete()

Implements hook_entity_ENTITY_TYPE_delete().

File

./entity_legal.module, line 86
Entity Legal module.

Code

function entity_legal_user_delete(UserInterface $account) {
  $acceptance_storage = \Drupal::entityTypeManager()
    ->getStorage(ENTITY_LEGAL_DOCUMENT_ACCEPTANCE_ENTITY_NAME);
  $aids = $acceptance_storage
    ->getQuery()
    ->condition('uid', $account
    ->id())
    ->execute();
  if ($aids) {
    $acceptance_storage
      ->delete($acceptance_storage
      ->loadMultiple($aids));
  }
}