12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace StatsBundle\Command;
- use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use RedisBundle\Services\RedisService;
- class RedisCommand extends BaseCommand
- {
- protected function configure()
- {
- $this
- ->setName('redis:read')
- ->setDescription('Read Redis data')
- ->setHelp('This command allows test redis')
- ->setDefinition(array(
- new InputOption('key', null, InputOption::VALUE_OPTIONAL, "Key redis", null)
- ))
- ;
- }
- /**
- * @param InputInterface $input
- * @param OutputInterface $output
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- parent::execute($input, $output);
-
- $key = $input->getOption('key');
- if(is_null($key)) {
- $this->output->writeln("key es nulo.");
- return true;
- }
- $data = $this->getData($key, true);
-
- if(empty($data)) {
- $this->output->writeln("Se requiere {$key}.");
- return true;
- }
- print_r(PHP_EOL."######################".PHP_EOL);
- print_r($data);
- print_r(PHP_EOL."######################".PHP_EOL);
-
-
- }
- }
|