Commit 9fdc7afc authored by Gaurav Kapoor's avatar Gaurav Kapoor Committed by Gaurav Kapoor
Browse files

Issue #3254885 by gaurav.kapoor: Role history not removed after user deletion

parent f5088d71
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -92,7 +92,12 @@ function role_watchdog_save_entity($name, $uid, $action, $user_performed_on, arr
 * Implements hook_ENTITY_TYPE_delete().
 */
function role_watchdog_user_delete(EntityInterface $account) {
  // TODO: different actions according to account cancellation.
  // Deleting all the role watchdog entities created because of a particular user.
  $query = \Drupal::entityQuery('role_watchdog')->condition('field_user_performed_on', $account->id());
  $ids = $query->execute();
  $storage_handler = \Drupal::entityTypeManager()->getStorage('role_watchdog');
  $entities = $storage_handler->loadMultiple($ids);
  $storage_handler->delete($entities);
}

/**