RoleStorageController.php 804 Bytes
Newer Older
1
2
3
4
<?php

/**
 * @file
5
 * Contains \Drupal\user\RoleStorageController.
6
7
8
9
10
11
12
13
14
 */

namespace Drupal\user;

use Drupal\Core\Config\Entity\ConfigStorageController;

/**
 * Controller class for user roles.
 */
15
class RoleStorageController extends ConfigStorageController implements RoleStorageControllerInterface {
16
17

  /**
18
   * {@inheritdoc}
19
   */
20
  public function deleteRoleReferences(array $rids) {
21
22
23
24
25
26
27
    // Remove the role from all users.
    db_delete('users_roles')
      ->condition('rid', $rids)
      ->execute();
  }

  /**
28
   * {@inheritdoc}
29
30
31
   */
  protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
    // Sort the queried roles by their weight.
32
    uasort($queried_entities, array($this->entityInfo['class'], 'sort'));
33
34
35
36
37

    parent::attachLoad($queried_entities, $revision_id);
  }

}