本文整理汇总了PHP中Symfony\Component\Console\Question\ChoiceQuestion::setMultiselect方法的典型用法代码示例。如果您正苦于以下问题:PHP ChoiceQuestion::setMultiselect方法的具体用法?PHP ChoiceQuestion::setMultiselect怎么用?PHP ChoiceQuestion::setMultiselect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Question\ChoiceQuestion
的用法示例。
在下文中一共展示了ChoiceQuestion::setMultiselect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->setForce($input->getOption('force'));
$this->setInput($input);
$this->setOutput($output);
$verbosityLevelMap = [LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL, LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL, LogLevel::DEBUG => OutputInterface::VERBOSITY_NORMAL];
$consoleLogger = new ConsoleLogger($output, $verbosityLevelMap);
$this->getContainer()->get('claroline.manager.user_manager')->setLogger($consoleLogger);
$helper = $this->getHelper('question');
//get excluding roles
$roles = $this->getContainer()->get('claroline.persistence.object_manager')->getRepository('ClarolineCoreBundle:Role')->findAllPlatformRoles();
$roleNames = array_map(function ($role) {
return $role->getName();
}, $roles);
$roleNames[] = 'NONE';
$all = $input->getOption('all');
$questionString = $all ? 'Roles to exclude: ' : 'Roles to include: ';
$question = new ChoiceQuestion($questionString, $roleNames);
$question->setMultiselect(true);
$roleNames = $helper->ask($input, $output, $question);
$rolesSearch = array_filter($roles, function ($role) use($roleNames) {
return in_array($role->getName(), $roleNames);
});
$this->deleteUsers($all, $rolesSearch);
}
示例2: interact
/**
* {@inheritdoc}
*/
protected function interact(InputInterface $input, OutputInterface $output)
{
/** @var StorageInterface $storage */
$storage = $this->getContainer()->get('storage');
$files = $input->getArgument('files');
if ($input->getOption('latest')) {
$remoteFiles = $storage->remoteListing();
if (count($remoteFiles) > 0) {
$files[] = end($remoteFiles);
$input->setArgument('files', $files);
}
}
if ($input->hasArgument('files') && !empty($files)) {
return;
}
$remoteFiles = $storage->remoteListing();
$localFiles = $storage->localListing();
if (count(array_diff($remoteFiles, $localFiles)) === 0) {
$output->writeln('All files fetched');
return;
}
$helper = $this->getHelper('question');
$question = new ChoiceQuestion('Which backup', array_values(array_diff($remoteFiles, $localFiles)));
$question->setMultiselect(true);
$question->setErrorMessage('Backup %s is invalid.');
$question->setAutocompleterValues([]);
$input->setArgument('files', $helper->ask($input, $output, $question));
}
示例3: handle
/**
* {@inheritdoc}
*/
protected function handle()
{
$plugins = elgg_get_plugins('inactive');
if (empty($plugins)) {
system_message('All plugins are active');
return;
}
$ids = array_map(function (ElggPlugin $plugin) {
return $plugin->getID();
}, $plugins);
$ids = array_values($ids);
if ($this->option('all')) {
$activate_ids = $ids;
} else {
$helper = $this->getHelper('question');
$question = new ChoiceQuestion('Please select plugins you would like to activate (comma-separated list of indexes)', $ids);
$question->setMultiselect(true);
$activate_ids = $helper->ask($this->input, $this->output, $question);
}
if (empty($activate_ids)) {
throw new \RuntimeException('You must select at least one plugin');
}
$plugins = [];
foreach ($activate_ids as $plugin_id) {
$plugins[] = elgg_get_plugin_from_id($plugin_id);
}
do {
$additional_plugins_activated = false;
foreach ($plugins as $key => $plugin) {
if ($plugin->isActive()) {
unset($plugins[$key]);
continue;
}
if (!$plugin->activate()) {
// plugin could not be activated in this loop, maybe in the next loop
continue;
}
$ids = array('cannot_start' . $plugin->getID(), 'invalid_and_deactivated_' . $plugin->getID());
foreach ($ids as $id) {
elgg_delete_admin_notice($id);
}
// mark that something has changed in this loop
$additional_plugins_activated = true;
unset($plugins[$key]);
system_message("Plugin {$plugin->getFriendlyName()} has been activated");
}
if (!$additional_plugins_activated) {
// no updates in this pass, break the loop
break;
}
} while (count($plugins) > 0);
if (count($plugins) > 0) {
foreach ($plugins as $plugin) {
$msg = $plugin->getError();
$string = $msg ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no';
register_error(elgg_echo($string, array($plugin->getFriendlyName())));
}
}
elgg_flush_caches();
}
示例4: binaryInstallWindows
/**
* @param string $path
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function binaryInstallWindows($path, InputInterface $input, OutputInterface $output)
{
$php = Engine::factory();
$table = new Table($output);
$table->setRows([['<info>' . $php->getName() . ' Path</info>', $php->getPath()], ['<info>' . $php->getName() . ' Version</info>', $php->getVersion()], ['<info>Compiler</info>', $php->getCompiler()], ['<info>Architecture</info>', $php->getArchitecture()], ['<info>Thread safety</info>', $php->getZts() ? 'yes' : 'no'], ['<info>Extension dir</info>', $php->getExtensionDir()], ['<info>php.ini</info>', $php->getIniPath()]])->render();
$inst = Install::factory($path);
$progress = $this->getHelperSet()->get('progress');
$inst->setProgress($progress);
$inst->setInput($input);
$inst->setOutput($output);
$inst->install();
$deps_handler = new Windows\DependencyLib($php);
$deps_handler->setProgress($progress);
$deps_handler->setInput($input);
$deps_handler->setOutput($output);
$helper = $this->getHelperSet()->get('question');
$cb = function ($choices) use($helper, $input, $output) {
$question = new ChoiceQuestion('Multiple choices found, please select the appropriate dependency package', $choices);
$question->setMultiselect(false);
return $helper->ask($input, $output, $question);
};
foreach ($inst->getExtDllPaths() as $dll) {
if (!$deps_handler->resolveForBin($dll, $cb)) {
throw new \Exception('Failed to resolve dependencies');
}
}
}
示例5: interact
protected function interact(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
if (trim($input->getOption('name')) == '') {
$question = new Question\Question('Please enter the client name: ');
$question->setValidator(function ($value) {
if (trim($value) == '') {
throw new \Exception('The client name can not be empty');
}
$doctrine = $this->getContainer()->get('doctrine');
$client = $doctrine->getRepository('AppBundle:Client')->findOneBy(['name' => $value]);
if ($client instanceof \AppBundle\Entity\Client) {
throw new \Exception('The client name must be unique');
}
return $value;
});
$question->setMaxAttempts(5);
$input->setOption('name', $helper->ask($input, $output, $question));
}
$grants = $input->getOption('grant-type');
if (!(is_array($grants) && count($grants))) {
$question = new Question\ChoiceQuestion('Please select the grant types (defaults to password and facebook_access_token): ', [\OAuth2\OAuth2::GRANT_TYPE_AUTH_CODE, \OAuth2\OAuth2::GRANT_TYPE_CLIENT_CREDENTIALS, \OAuth2\OAuth2::GRANT_TYPE_EXTENSIONS, \OAuth2\OAuth2::GRANT_TYPE_IMPLICIT, \OAuth2\OAuth2::GRANT_TYPE_REFRESH_TOKEN, \OAuth2\OAuth2::GRANT_TYPE_USER_CREDENTIALS, 'http://grants.api.schoolmanager.ledo.eu.org/facebook_access_token'], '5,6');
$question->setMultiselect(true);
$question->setMaxAttempts(5);
$input->setOption('grant-type', $helper->ask($input, $output, $question));
}
parent::interact($input, $output);
}
示例6: testAskChoice
public function testAskChoice()
{
$questionHelper = new SymfonyQuestionHelper();
$helperSet = new HelperSet(array(new FormatterHelper()));
$questionHelper->setHelperSet($helperSet);
$heroes = array('Superman', 'Batman', 'Spiderman');
$inputStream = $this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n");
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2');
$question->setMaxAttempts(1);
// first answer is an empty answer, we're supposed to receive the default value
$this->assertEquals('Spiderman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question));
$this->assertOutputContains('What is your favorite superhero? [Spiderman]', $output);
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
$question->setMaxAttempts(1);
$this->assertEquals('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$this->assertEquals('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
$question->setErrorMessage('Input "%s" is not a superhero!');
$question->setMaxAttempts(2);
$this->assertEquals('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question));
$this->assertOutputContains('Input "Fabien" is not a superhero!', $output);
try {
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1');
$question->setMaxAttempts(1);
$questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question);
$this->fail();
} catch (\InvalidArgumentException $e) {
$this->assertEquals('Value "Fabien" is invalid', $e->getMessage());
}
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
$question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1');
$question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question));
$this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output);
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 ');
$question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question));
$this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output);
}
示例7: choice
public function choice($question, array $choices, $default = null, $multiple = false)
{
if (null !== $default) {
$values = array_flip($choices);
$default = $values[$default];
}
$choiceQuestion = new ChoiceQuestion($question, $choices, $default);
$choiceQuestion->setMultiselect($multiple);
return $this->askQuestion($choiceQuestion);
}
示例8: getWebContainerNames
protected function getWebContainerNames($containers, InputInterface $input, OutputInterface $output)
{
# Prompt the user
$helper = $this->getHelperSet()->get('question');
$containers[] = 'all';
$question = new ChoiceQuestion('<fg=cyan;bg=blue>Please select the numbers corresponding to which DrupalCI web environments to support. Separate multiple entries with commas. (Default: [0])</fg=cyan;bg=blue>', $containers, '0');
$question->setMultiselect(true);
$results = $helper->ask($input, $output, $question);
return $results;
}
示例9: execute
/**
* {@inheritdoc}
*/
public function execute(InputInterface $input, OutputInterface $output)
{
// TODO: Ensure that configurations have been initialized
// Get available config sets
$helper = new ConfigHelper();
$configsets = $helper->getAllConfigSets();
$homedir = getenv('HOME');
// Check if passed argument is 'all'
$names = $input->getArgument('setting');
if (empty($names)) {
// If no argument passed, prompt the user for which config set to display
$qhelper = $this->getHelper('question');
$message = "<question>Choose the number corresponding to which configuration set(s) to display:</question> ";
$output->writeln($message);
$message = "<comment>Separate multiple values with commas.</comment>";
$options = array_merge(array_keys($configsets), array('current', 'all'));
$question = new ChoiceQuestion($message, $options, 0);
$question->setMultiselect(TRUE);
$names = $qhelper->ask($input, $output, $question);
}
if (in_array('all', $names)) {
$names = array_keys($configsets);
}
// Is passed config set valid?
foreach ($names as $key => $name) {
if ($name == 'current') {
$env_vars = $helper->getCurrentEnvVars();
$output->writeln("<info>---------------- Start config set: <options=bold>CURRENT DCI ENVIRONMENT</options=bold></info> ----------------</info>");
$output->writeln("<comment;options=bold>Defined in ~/.drupalci/config:</comment;options=bold>");
$contents = $helper->getCurrentConfigSetContents();
foreach ($contents as $line) {
$parsed = explode("=", $line);
if (!empty($parsed[0]) && !empty($parsed[1])) {
$output->writeln("<comment>" . strtoupper($parsed[0]) . ": </comment><info>" . $parsed[1] . "</info>");
}
}
if (!empty($env_vars)) {
$output->writeln("<comment;options=bold>Defined in Environment Variables:</comment;options=bold>");
foreach ($env_vars as $key => $value) {
$output->writeln("<comment>" . strtoupper($key) . ": </comment><info>" . $value . "</info>");
}
$output->writeln("<info>------------ End config set: <options=bold>CURRENT DCI ENVIRONMENT</options=bold></info> ----------------</info>");
$output->writeln('');
}
} elseif (in_array($name, array_keys($configsets))) {
$contents = file_get_contents($configsets[$name]);
$output->writeln("<info>---------------- Start config set: <options=bold>{$name}</options=bold></info> ----------------</info>");
$output->writeln($contents);
$output->writeln("<info>------------ End config set: <options=bold>{$name}</options=bold></info> ----------------</info>");
$output->writeln('');
} else {
$output->writeln("<error>Configuration set '{$name}' not found. Skipping.</error>");
}
}
}
示例10: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
// Busca todas tabelas do banco
$getTables = array_map(function ($value) {
return array_values($value)[0];
}, $this->get('db')->fetchAll('SHOW TABLES', array()));
// Remove a tabela de usuário da lista
$getTables = array_filter($getTables, function ($campo) {
return $campo !== 'users';
});
if (count($getTables) === 0) {
return $output->writeln('<error>Nenhuma tabela foi encontrada.</error>');
}
if ($input->getOption('tables') === null) {
$helper = $this->getHelper('question');
$question = new ChoiceQuestion('Selecione as tabelas para gerar os padrões CRUD <comment>(pressione em branco para selecionar todas)</comment>', $getTables, implode(',', array_keys($getTables)));
$question->setMultiselect(true);
$tables_generate = $helper->ask($input, $output, $question);
} else {
$tables_in = explode(',', $input->getOption('tables'));
$tables_generate = array();
foreach ($tables_in as $table_in) {
if (in_array($table_in, $getTables)) {
$tables_generate[] = $table_in;
}
}
}
if (count($tables_generate) === 0) {
return $output->writeln('<error>Nenhuma tabela foi selecionada.</error>');
}
$output->writeln('Você selecionou: <comment>' . implode('</comment>, <comment>', $tables_generate) . '</comment>');
$tables = array();
foreach ($tables_generate as $table_name) {
if ($output->isVerbose()) {
$output->writeln(sprintf('Capturando informações sobre a tabela <comment>"%s"</comment>', $table_name));
}
$table_info = $this->getInfoTable($table_name, $input, $output);
if (is_array($table_info)) {
$tables[$table_name] = $table_info;
} else {
if ($output->isVerbose()) {
$output->writeln(sprintf('<info>A tabela "%s" não será gerada.</info>', $table_name));
}
}
}
$output->writeln('Aguarde estamos gerando...');
foreach ($tables as $table_name => $data) {
$this->createController($table_name, $data, $input, $output);
$this->createViews($table_name, $data, $input, $output);
$this->createRoutes($table_name, $data, $input, $output);
$this->createMenu($table_name, $data, $input, $output);
}
}
示例11: askRoles
public function askRoles($all, $input, $output, $container, $helper)
{
$roles = $container->get('claroline.persistence.object_manager')->getRepository('ClarolineCoreBundle:Role')->findAllPlatformRoles();
$roleNames = array_map(function ($role) {
return $role->getName();
}, $roles);
$roleNames[] = 'NONE';
$questionString = $all ? 'Roles to exclude: ' : 'Roles to include: ';
$question = new ChoiceQuestion($questionString, $roleNames);
$question->setMultiselect(true);
$roleNames = $helper->ask($input, $output, $question);
return array_filter($roles, function ($role) use($roleNames) {
return in_array($role->getName(), $roleNames);
});
}
示例12: interact
protected function interact(InputInterface $input, OutputInterface $output)
{
$this->metadata = [];
$dialog = $this->getDialogHelper();
$moduleHandler = $this->getModuleHandler();
$drupal = $this->getDrupalHelper();
$questionHelper = $this->getQuestionHelper();
// --module option
$module = $input->getOption('module');
if (!$module) {
// @see Drupal\Console\Command\ModuleTrait::moduleQuestion
$module = $this->moduleQuestion($output, $dialog);
}
$input->setOption('module', $module);
// --class-name option
$form_id = $input->getOption('form-id');
if (!$form_id) {
$forms = [];
// Get form ids from webprofiler
if ($moduleHandler->moduleExists('webprofiler')) {
$output->writeln('[-] <info>' . $this->trans('commands.generate.form.alter.messages.loading-forms') . '</info>');
$forms = $this->getWebprofilerForms();
}
if (!empty($forms)) {
$form_id = $dialog->askAndValidate($output, $dialog->getQuestion($this->trans('commands.generate.form.alter.options.form-id'), current(array_keys($forms))), function ($form) {
return $form;
}, false, '', array_combine(array_keys($forms), array_keys($forms)));
}
}
if ($moduleHandler->moduleExists('webprofiler') && isset($forms[$form_id])) {
$this->metadata['class'] = $forms[$form_id]['class']['class'];
$this->metadata['method'] = $forms[$form_id]['class']['method'];
$this->metadata['file'] = str_replace($drupal->getRoot(), '', $forms[$form_id]['class']['file']);
$formItems = array_keys($forms[$form_id]['form']);
$question = new ChoiceQuestion($this->trans('commands.generate.form.alter.messages.hide-form-elements'), array_combine($formItems, $formItems), '0');
$question->setMultiselect(true);
$question->setValidator(function ($answer) {
return $answer;
});
$formItemsToHide = $questionHelper->ask($input, $output, $question);
$this->metadata['unset'] = array_filter(array_map('trim', explode(',', $formItemsToHide)));
}
$input->setOption('form-id', $form_id);
$output->writeln($this->trans('commands.generate.form.alter.messages.inputs'));
// @see Drupal\Console\Command\FormTrait::formQuestion
$form = $this->formQuestion($output, $dialog);
$input->setOption('inputs', $form);
}
示例13: interact
protected function interact(InputInterface $input, OutputInterface $output)
{
$params = ['old_string' => 'The string to match', 'new_string' => 'The string to replace'];
foreach ($params as $argument => $argumentName) {
if (!$input->getArgument($argument)) {
$input->setArgument($argument, $this->askArgument($output, $argumentName));
}
}
$helper = $this->getHelper('question');
$entities = array_keys($this->getParsableEntities());
$question = new ChoiceQuestion('Entity to parse: ', $entities);
$question->setMultiselect(true);
while (null === ($entity = $input->getArgument('classes'))) {
$entity = $helper->ask($input, $output, $question);
$input->setArgument('classes', $entity);
}
}
示例14: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$removeUsers = $input->getOption('user');
$removeGroups = $input->getOption('group');
$container = $this->getContainer();
$helper = $this->getHelper('question');
$workspaceManager = $this->getContainer()->get('claroline.manager.workspace_manager');
$roleManager = $this->getContainer()->get('claroline.manager.role_manager');
$question = new Question('Filter on code (continue if no filter)', null);
$code = $helper->ask($input, $output, $question);
$question = new Question('Filter on name (continue if no filter)', null);
$name = $helper->ask($input, $output, $question);
$workspaces = $workspaceManager->getNonPersonalByCodeAndName($code, $name);
$om = $container->get('claroline.persistence.object_manager');
foreach ($workspaces as $workspace) {
$roles = $roleManager->getRolesByWorkspace($workspace);
$roleNames = array_map(function ($role) {
return $role->getTranslationKey();
}, $roles);
$roleNames[] = 'NONE';
$questionString = "Pick a role list for [{$workspace->getName()} - {$workspace->getCode()}]:";
$question = new ChoiceQuestion($questionString, $roleNames);
$question->setMultiselect(true);
$roleNames = $helper->ask($input, $output, $question);
$pickedRoles = array_filter($roles, function ($role) use($roleNames) {
return in_array($role->getTranslationKey(), $roleNames);
});
$om->startFlushSuite();
foreach ($pickedRoles as $role) {
if ($removeUsers) {
$count = $om->getRepository('ClarolineCoreBundle:User')->countUsersByRole($role);
$output->writeln("Removing {$count} users from role {$role->getTranslationKey()}");
$roleManager->emptyRole($role, RoleManager::EMPTY_USERS);
}
if ($removeGroups) {
$count = $om->getRepository('ClarolineCoreBundle:Group')->countGroupsByRole($role);
$output->writeln("Removing {$count} groups from role {$role->getTranslationKey()}");
$roleManager->emptyRole($role, RoleManager::EMPTY_GROUPS);
}
}
$om->endFlushSuite();
}
}
示例15: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$dialog = $this->getDialogHelper();
$questionHelper = $this->getQuestionHelper();
$resource_id = $input->getArgument('resource-id');
$rest_resources = $this->getRestResources();
$rest_resources_ids = array_merge(array_keys($rest_resources['enabled']), array_keys($rest_resources['disabled']));
if (!$resource_id) {
$resource_id = $dialog->askAndValidate($output, $dialog->getQuestion($this->trans('commands.rest.enable.arguments.resource-id'), ''), function ($resource_id) use($rest_resources_ids) {
return $this->validateRestResource($resource_id, $rest_resources_ids, $this->getTranslator());
}, false, '', $rest_resources_ids);
}
$this->validateRestResource($resource_id, $rest_resources_ids, $this->getTranslator());
$input->setArgument('resource-id', $resource_id);
// Calculate states available by resource and generate the question
$resourcePluginManager = $this->getPluginManagerRest();
$plugin = $resourcePluginManager->getInstance(array('id' => $resource_id));
$states = $plugin->availableMethods();
$question = new ChoiceQuestion($this->trans('commands.rest.enable.arguments.states'), array_combine($states, $states), '0');
$state = $questionHelper->ask($input, $output, $question);
$output->writeln($this->trans('commands.rest.enable.messages.selected-state') . ' ' . $state);
// Get serializer formats available and generate the question.
$formats = $this->getSerializerFormats();
$question = new ChoiceQuestion($this->trans('commands.rest.enable.messages.formats'), array_combine($formats, $formats), '0');
$question->setMultiselect(true);
$formats = $questionHelper->ask($input, $output, $question);
$output->writeln($this->trans('commands.rest.enable.messages.selected-formats') . ' ' . implode(', ', $formats));
// Get Authentication Provider and generate the question
$authentication_providers = $this->getAuthenticationProviders();
$question = new ChoiceQuestion($this->trans('commands.rest.enable.messages.authentication-providers'), array_combine(array_keys($authentication_providers), array_keys($authentication_providers)), '0');
$question->setMultiselect(true);
$authentication_providers = $questionHelper->ask($input, $output, $question);
$output->writeln($this->trans('commands.rest.enable.messages.selected-authentication-providers') . ' ' . implode(', ', $authentication_providers));
$rest_settings = $this->getRestDrupalConfig();
$rest_settings[$resource_id][$state]['supported_formats'] = $formats;
$rest_settings[$resource_id][$state]['supported_auth'] = $authentication_providers;
$config = $this->getConfigFactory()->getEditable('rest.settings');
$config->set('resources', $rest_settings);
$config->save();
// Run cache rebuild to enable rest routing
$this->getChain()->addCommand('cache:rebuild', ['cache' => 'all']);
}