protected function RoleStorageController::postDelete

Acts on deleted entities before the delete hook is invoked.

Used after the entities are deleted but before invoking the delete hook.

Overrides ConfigStorageController::postDelete

File

drupal/core/modules/user/lib/Drupal/user/RoleStorageController.php, line 46
Contains \Drupal\user\RoleStorageController.

Class

RoleStorageController
Controller class for user roles.

Namespace

Drupal\user

Code

protected function postDelete($entities) {
  $rids = array_keys($entities);

  // Delete permission assignments.
  db_delete('role_permission')
    ->condition('rid', $rids)
    ->execute();

  // Remove the role from all users.
  db_delete('users_roles')
    ->condition('rid', $rids)
    ->execute();
}