64 lines
2.1 KiB
PHP
64 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace Wowow\Debug\Console\Command;
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
use Wowow\Debug\Console\Command\DebugOptionsInterface as Options;
|
|
use Symfony\Component\Console\Input\ArrayInput;
|
|
|
|
class DebugCommand extends Command
|
|
{
|
|
protected $input;
|
|
|
|
protected $_resourceConfig;
|
|
|
|
const FOR_HINTS = 'for-hints';
|
|
|
|
const VALUE_HINTS = 'value-hints';
|
|
|
|
public function __construct(
|
|
\Magento\Config\Model\ResourceModel\Config $resourceConfig
|
|
){
|
|
$this->_resourceConfig = $resourceConfig;
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function configure()
|
|
{
|
|
$this->setName('wowow:debug')->setDescription('Enabled Template Path Hints.')
|
|
->setDefinition([
|
|
new InputOption(
|
|
Options::FOR_HINTS,
|
|
'-f',
|
|
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
|
|
'active le chemin pour le front ou le back',
|
|
['storefront']
|
|
),new InputOption(
|
|
Options::VALUE_HINTS,
|
|
'-z',
|
|
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
|
|
'active ou desactive les chemins',
|
|
['1']
|
|
)]);
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$this->input = $input;
|
|
$path = $this->input->getOption(Options::FOR_HINTS)[0];
|
|
$value = $this->input->getOption(Options::VALUE_HINTS)[0];
|
|
$scope = 'default';
|
|
$scopeId = 0;
|
|
$attr = 'dev/debug/template_hints_'.$path;
|
|
|
|
$this->_resourceConfig->saveConfig($attr,$value,$scope,$scopeId);
|
|
$command = $this->getApplication()->find('cache:clean');
|
|
$returnCode = $command->run(new ArrayInput(array('command' => 'cache:clean')),$output);
|
|
if(!$returnCode) $output->writeln('successfully finished');
|
|
}
|
|
|
|
} |