use Symfony\Component\Console\Input\InputArgument;
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\Annotations\DrupalCommand;
-use Drupal\Console\Core\Style\DrupalStyle;
use Drupal\Console\Command\Shared\RestTrait;
use Drupal\Core\Config\ConfigFactory;
use Drupal\rest\Plugin\Type\ResourcePluginManager;
*/
class DisableCommand extends Command
{
- use CommandTrait;
use RestTrait;
/**
'resource-id',
InputArgument::OPTIONAL,
$this->trans('commands.rest.debug.arguments.resource-id')
- );
+ )
+ ->setAliases(['red']);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$resource_id = $input->getArgument('resource-id');
$rest_resources = $this->getRestResources();
$rest_resources_ids = array_merge(
);
if (!$resource_id) {
- $resource_id = $io->choice(
+ $resource_id = $this->getIo()->choice(
$this->trans('commands.rest.disable.arguments.resource-id'),
$rest_resources_ids
);
// Rebuild routing cache.
$routeBuilder->rebuild();
- $io->success(
+ $this->getIo()->success(
sprintf(
$this->trans('commands.rest.disable.messages.success'),
$resource_id
return true;
}
$message = sprintf($this->trans('commands.rest.disable.messages.already-disabled'), $resource_id);
- $io->info($message);
+ $this->getIo()->info($message);
return true;
}