FooCommand.php 768B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. use Symfony\Component\Console\Command\Command;
  3. use Symfony\Component\Console\Input\InputInterface;
  4. use Symfony\Component\Console\Output\OutputInterface;
  5. class FooCommand extends Command
  6. {
  7. public $input;
  8. public $output;
  9. protected function configure()
  10. {
  11. $this
  12. ->setName('foo:bar')
  13. ->setDescription('The foo:bar command')
  14. ->setAliases(array('afoobar'))
  15. ;
  16. }
  17. protected function interact(InputInterface $input, OutputInterface $output)
  18. {
  19. $output->writeln('interact called');
  20. }
  21. protected function execute(InputInterface $input, OutputInterface $output)
  22. {
  23. $this->input = $input;
  24. $this->output = $output;
  25. $output->writeln('called');
  26. }
  27. }