X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FUser%2FRoleCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FUser%2FRoleCommand.php;h=71d618aaf7b1f9348617d8c09ab86e2a13e7d2a6;hp=d0cc197338659035708e6390851f2107867c402e;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console/src/Command/User/RoleCommand.php b/vendor/drupal/console/src/Command/User/RoleCommand.php index d0cc19733..71d618aaf 100644 --- a/vendor/drupal/console/src/Command/User/RoleCommand.php +++ b/vendor/drupal/console/src/Command/User/RoleCommand.php @@ -10,10 +10,8 @@ namespace Drupal\Console\Command\User; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Utils\DrupalApi; -use Drupal\Console\Core\Style\DrupalStyle; /** * Class DebugCommand @@ -22,8 +20,6 @@ use Drupal\Console\Core\Style\DrupalStyle; */ class RoleCommand extends Command { - use CommandTrait; - /** * @var DrupalApi */ @@ -51,24 +47,24 @@ class RoleCommand extends Command ->addArgument( 'operation', InputOption::VALUE_REQUIRED, - $this->trans('commands.user.role.operation') + $this->trans('commands.user.role.arguments.operation') ) ->addArgument( 'user', InputOption::VALUE_REQUIRED, - $this->trans('commands.user.role.user') + $this->trans('commands.user.role.arguments.user') ) ->addArgument( 'role', InputOption::VALUE_REQUIRED, - $this->trans('commands.user.role.role') - ); + $this->trans('commands.user.role.arguments.roles') + )->setAliases(['ur']); } /** * {@inheritdoc} */ - protected function interact(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output) { $operation = $input->getArgument('operation'); $user = $input->getArgument('user'); @@ -79,17 +75,6 @@ class RoleCommand extends Command $this->trans('commands.user.role.messages.bad-arguments') ); } - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - $operation = $input->getArgument('operation'); - $user = $input->getArgument('user'); - $role = $input->getArgument('role'); $systemRoles = $this->drupalApi->getRoles(); @@ -107,19 +92,19 @@ class RoleCommand extends Command } if (!is_object($userObject)) { - $io->error(sprintf($this->trans('commands.user.role.messages.no-user-found'), $user)); + $this->getIo()->error(sprintf($this->trans('commands.user.role.messages.no-user-found'), $user)); return 1; } if (!array_key_exists($role, $systemRoles)) { - $io->error(sprintf($this->trans('commands.user.role.messages.no-role-found'), $role)); + $this->getIo()->error(sprintf($this->trans('commands.user.role.messages.no-role-found'), $role)); return 1; } if ("add" == $operation) { $userObject->addRole($role); $userObject->save(); - $io->success( + $this->getIo()->success( sprintf( $this->trans('commands.user.role.messages.add-success'), $userObject->name->value . " (" . $userObject->mail->value . ") ", @@ -132,7 +117,7 @@ class RoleCommand extends Command $userObject->removeRole($role); $userObject->save(); - $io->success( + $this->getIo()->success( sprintf( $this->trans('commands.user.role.messages.remove-success'), $userObject->name->value . " (" . $userObject->mail->value . ") ",