You are here

public function UserStorage::deleteRoleReferences in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::deleteRoleReferences()

Delete role references.

Parameters

array $rids: The list of role IDs being deleted. The storage should remove permission and user references to this role.

Overrides UserStorageInterface::deleteRoleReferences

File

core/modules/user/src/UserStorage.php, line 67

Class

UserStorage
Controller class for users.

Namespace

Drupal\user

Code

public function deleteRoleReferences(array $rids) {

  // Remove the role from all users.
  $this->database
    ->delete('user__roles')
    ->condition('roles_target_id', $rids)
    ->execute();
  $this
    ->resetCache();
}