diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/UserRidQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/UserRidQueryTest.php index 7438375..2303e17 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/UserRidQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/UserRidQueryTest.php @@ -9,11 +9,14 @@ class UserRidQueryTest extends EntityUnitTestBase { + /** + * {@inheritdoc} + */ static public function getInfo() { return array( - 'name' => 'User rid Query', + 'name' => 'User role entity query', 'description' => 'Tests the special Entity Query service for user roles.', - 'group' => 'Entity API', + 'group' => 'User', ); } @@ -40,6 +43,12 @@ public function testUserRoleQuery() { $this->assertEqual(count($results), 1); $this->assertEqual(reset($results), $accounts[$perm]->id()); } + + // Test a query with an IN condition for both roles. + $results = \Drupal::entityQuery('user') + ->condition('rid', $roles) + ->execute(); + $this->assertEqual(count($results), 2); } } diff --git a/core/modules/user/lib/Drupal/user/Entity/Query/Sql/Tables.php b/core/modules/user/lib/Drupal/user/Entity/Query/Sql/Tables.php index 5118e74..2044fe0 100644 --- a/core/modules/user/lib/Drupal/user/Entity/Query/Sql/Tables.php +++ b/core/modules/user/lib/Drupal/user/Entity/Query/Sql/Tables.php @@ -9,8 +9,14 @@ use Drupal\Core\Entity\Query\Sql\Tables as BaseTables; +/** + * Ensures that the users_roles table is available for queries. + */ class Tables extends BaseTables { + /** + * {@inheritdoc} + */ protected function ensureEntityTable($index_prefix, $property, $type, $langcode, $base_table, $id_field, $entity_tables) { $entity_tables['users_roles'] = drupal_get_schema('users_roles'); return parent::ensureEntityTable($index_prefix, $property, $type, $langcode, $base_table, $id_field, $entity_tables); diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php index 0a0d739..01ae9e8 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php @@ -52,7 +52,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.entity')->getStorageController('user')); + return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager')->getStorageController('user')); } /**