5 * Contains \Drupal\Console\Command\Cache\TagInvalidateCommand.
8 namespace Drupal\Console\Command\Cache;
10 use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
11 use Drupal\Console\Core\Command\Command;
12 use Symfony\Component\Console\Input\InputArgument;
13 use Symfony\Component\Console\Input\InputInterface;
14 use Symfony\Component\Console\Output\OutputInterface;
16 class TagInvalidateCommand extends Command
19 * @var CacheTagsInvalidatorInterface
21 protected $invalidator;
24 * TagInvalidateCommand constructor.
26 * @param CacheTagsInvalidatorInterface $invalidator
28 public function __construct(CacheTagsInvalidatorInterface $invalidator)
30 parent::__construct();
31 $this->invalidator = $invalidator;
37 protected function configure()
40 ->setName('cache:tag:invalidate')
41 ->setDescription($this->trans('commands.cache.tag.invalidate.description'))
44 InputArgument::REQUIRED | InputArgument::IS_ARRAY,
45 $this->trans('commands.cache.tag.invalidate.options.tag')
47 ->setAliases(['cti']);
53 protected function execute(InputInterface $input, OutputInterface $output)
55 $tags = $input->getArgument('tag');
57 $this->getIo()->comment(
59 $this->trans('commands.cache.tag.invalidate.messages.start'),
64 $this->invalidator->invalidateTags($tags);
65 $this->getIo()->success($this->trans('commands.cache.tag.invalidate.messages.completed'));