class GenerateUsersCommand
Attributes
#[AsCommand(name: 'devel-generate:users', description: 'Create users.', aliases: [
'genu',
'devel-generate-users',
])]
Hierarchy
- class \Drupal\devel_generate\Drush\Commands\GenerateUsersCommand uses \Drush\Commands\AutowireTrait extends \Symfony\Component\Console\Command\Command
Expanded class hierarchy of GenerateUsersCommand
File
-
devel_generate/
src/ Drush/ Commands/ GenerateUsersCommand.php, line 16
Namespace
Drupal\devel_generate\Drush\CommandsView source
final class GenerateUsersCommand extends Command {
use AutowireTrait;
const PLUGIN_ID = 'user';
public function __construct(protected DevelGeneratePluginManager $manager) {
parent::__construct();
}
protected function configure() : void {
$this->addArgument('num', InputArgument::OPTIONAL, 'Number of users to generate.', 50)
->addOption('kill', NULL, InputOption::VALUE_NONE, 'Delete all users before generating new ones.')
->addOption('roles', NULL, InputOption::VALUE_REQUIRED, 'A comma delimited list of role IDs for new users. Don\'t specify authenticated.')
->addOption('pass', NULL, InputOption::VALUE_REQUIRED, 'Specify a password to be set for all generated users.');
}
public function execute(InputInterface $input, OutputInterface $output) : int {
/** @var \Drupal\devel_generate\DevelGenerateBaseInterface $instance */
$instance = $this->manager
->createInstance(self::PLUGIN_ID, []);
$parameters = $instance->validateDrushParams($input->getArguments(), $input->getOptions());
$instance->generate($parameters);
return Command::SUCCESS;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| GenerateUsersCommand::configure | protected | function | |
| GenerateUsersCommand::execute | public | function | |
| GenerateUsersCommand::PLUGIN_ID | constant | ||
| GenerateUsersCommand::__construct | public | function |