class GenerateUsersCommand

Same name in this branch
  1. 5.x devel_generate/src/Drush/Commands/GenerateUsersCommand.php \Drupal\devel_generate\Drush\Commands\GenerateUsersCommand

Create users.

Attributes

#[AsCommand(name: self::NAME, description: 'Create users.', aliases: [ 'genu', 'devel-generate-users', ], usages: [ 'devel-generate:users 20 --roles=editor --kill', ])]

Hierarchy

Expanded class hierarchy of GenerateUsersCommand

2 files declare their use of GenerateUsersCommand
GenerateCommandsKernelTest.php in devel_generate/tests/src/Kernel/GenerateCommandsKernelTest.php
GenerateUsersCommand.php in devel_generate/src/Drush/Commands/GenerateUsersCommand.php

File

devel_generate/src/Command/GenerateUsersCommand.php, line 16

Namespace

Drupal\devel_generate\Command
View source
class GenerateUsersCommand {
  use GenerateCommandTrait;
  public const NAME = 'devel-generate:users';
  public const PLUGIN_ID = 'user';
  
  /**
   * Create users.
   *
   * The arguments and options are read from the input by the plugin.
   */
  public function __invoke(InputInterface $input, OutputInterface $output, #[Argument('Number of users to generate.')] string $num = '50', #[Option('Delete all users before generating new ones.')] bool $kill = FALSE, #[Option('A comma delimited list of role IDs for new users. Don\'t specify authenticated.')] ?string $roles = NULL, #[Option('Specify a password to be set for all generated users.')] ?string $pass = NULL) : int {
    return $this->generate(self::PLUGIN_ID, $input, $output);
  }

}

Members

Title Sort descending Modifiers Object type Summary
GenerateCommandTrait::generate protected function Generates with the given plugin, from the command's arguments and options.
GenerateCommandTrait::processBatch protected function Runs the batch that a plugin has set, if any, in this process.
GenerateCommandTrait::writeMessages protected function Writes the messages that the plugin has set, and clears them.
GenerateCommandTrait::__construct public function
GenerateUsersCommand::NAME public constant
GenerateUsersCommand::PLUGIN_ID public constant
GenerateUsersCommand::__invoke public function Create users.