Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractCacheSetCommand.php
Go to the documentation of this file.
1 <?php
8 
9 use Symfony\Component\Console\Input\InputInterface;
10 use Symfony\Component\Console\Output\OutputInterface;
11 
17 {
23  abstract protected function isEnable();
24 
28  protected function execute(InputInterface $input, OutputInterface $output)
29  {
30  $isEnable = $this->isEnable();
31  $types = $this->getRequestedTypes($input);
32  $changedTypes = $this->cacheManager->setEnabled($types, $isEnable);
33  if ($changedTypes) {
34  $output->writeln('Changed cache status:');
35  foreach ($changedTypes as $type) {
36  $output->writeln(sprintf('%30s: %d -> %d', $type, !$isEnable, $isEnable));
37  }
38  } else {
39  $output->writeln('There is nothing to change in cache status');
40  }
41  if (!empty($changedTypes) && $isEnable) {
42  $this->cacheManager->clean($changedTypes);
43  $output->writeln('Cleaned cache types:');
44  $output->writeln(join(PHP_EOL, $changedTypes));
45  }
46  }
47 }
execute(InputInterface $input, OutputInterface $output)
$type
Definition: item.phtml:13