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\Command;
use Drupal\Core\State\StateInterface;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
/**
* Class AccessRebuildCommand
*/
class AccessRebuildCommand extends Command
{
- use CommandTrait;
-
/**
* @var StateInterface
*/
null,
InputOption::VALUE_NONE,
$this->trans('commands.node.access.rebuild.options.batch')
- );
+ )->setAliases(['nar']);
}
/**
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
- $io->newLine();
- $io->comment(
+ $this->getIo()->newLine();
+ $this->getIo()->comment(
$this->trans('commands.node.access.rebuild.messages.rebuild')
);
try {
node_access_rebuild($batch);
} catch (\Exception $e) {
- $io->error($e->getMessage());
+ $this->getIo()->error($e->getMessage());
return 1;
}
$needs_rebuild = $this->state->get('node.node_access_needs_rebuild') ? : false;
if ($needs_rebuild) {
- $io->error(
+ $this->getIo()->error(
$this->trans('commands.node.access.rebuild.messages.failed')
);
return 1;
}
- $io->success(
+ $this->getIo()->success(
$this->trans('commands.node.access.rebuild.messages.completed')
);
return 0;