Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2.  
  3. namespace InchooConsoleConsoleCommand;
  4. use SymfonyComponentConsoleCommandCommand;
  5. use SymfonyComponentConsoleInputInputInterface;
  6. use SymfonyComponentConsoleOutputOutputInterface;
  7. use MagentoFrameworkObjectManagerInterface;
  8. class HelloWorldCommand extends Command
  9. {
  10. protected $_objectManager;
  11.  
  12. public function __construct(ObjectManagerInterface $objectManager){
  13. $this->_objectManager = $objectManager;
  14. }
  15. protected function configure()
  16. {
  17. $this->setName('inchoo:hello_world')->setDescription('Prints hello world.');
  18. }
  19.  
  20. protected function execute(InputInterface $input, OutputInterface $output)
  21. {
  22. $question = $this->_objectManager->create('SymfonyComponentConsoleQuestionConfirmationQuestion', ['question'=>'your question', 'default' => FALSE]);
  23. echo $ans = $helper->ask($input, $output, $question);
  24. if ($ans == 'yes') {
  25. $output->writeln('Hello World!');
  26. }else{
  27. $output->writeln('Noooooooo');
  28. }
  29. $output->writeln('Done!');
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement