|
6 | 6 | use Consolidation\OutputFormatters\Options\FormatterOptions; |
7 | 7 | use Consolidation\OutputFormatters\StructuredData\RowsOfFields; |
8 | 8 | use Consolidation\SiteAlias\SiteAliasManagerAwareTrait; |
| 9 | +use Drupal\user\Entity\Role; |
9 | 10 | use Drupal\user\Entity\User; |
10 | 11 | use Drush\Commands\DrushCommands; |
11 | 12 | use Drush\Drush; |
@@ -72,12 +73,14 @@ class UsersCommands extends DrushCommands implements SiteAliasManagerAwareInterf |
72 | 73 | * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields |
73 | 74 | * The users as a RowsOfFields. |
74 | 75 | */ |
75 | | - public function listAll(array $options = [ |
76 | | - 'status' => InputOption::VALUE_REQUIRED, |
77 | | - 'roles' => InputOption::VALUE_REQUIRED, |
78 | | - 'no-roles' => InputOption::VALUE_REQUIRED, |
79 | | - 'last-login' => InputOption::VALUE_REQUIRED, |
80 | | - ]) { |
| 76 | + public function listAll( |
| 77 | + array $options = [ |
| 78 | + 'status' => InputOption::VALUE_REQUIRED, |
| 79 | + 'roles' => InputOption::VALUE_REQUIRED, |
| 80 | + 'no-roles' => InputOption::VALUE_REQUIRED, |
| 81 | + 'last-login' => InputOption::VALUE_REQUIRED, |
| 82 | + ], |
| 83 | + ) { |
81 | 84 | // Use an entityQuery to dynamically set property conditions. |
82 | 85 | $query = \Drupal::entityQuery('user') |
83 | 86 | ->accessCheck(FALSE) |
@@ -156,7 +159,7 @@ public function validateList(CommandData $commandData) { |
156 | 159 | } |
157 | 160 |
|
158 | 161 | // Set the (no-)roles options to an array but validate each one exists. |
159 | | - $actual = user_roles(TRUE); |
| 162 | + $actual = Role::loadMultiple(); |
160 | 163 |
|
161 | 164 | foreach (['roles', 'no-roles'] as $option) { |
162 | 165 | if ($roles = $input->getOption($option)) { |
|
0 commit comments