Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace InchooConsoleConsoleCommand;
- use SymfonyComponentConsoleCommandCommand;
- use SymfonyComponentConsoleInputInputInterface;
- use SymfonyComponentConsoleOutputOutputInterface;
- use MagentoFrameworkObjectManagerInterface;
- class HelloWorldCommand extends Command
- {
- protected $_objectManager;
- public function __construct(ObjectManagerInterface $objectManager){
- $this->_objectManager = $objectManager;
- }
- protected function configure()
- {
- $this->setName('inchoo:hello_world')->setDescription('Prints hello world.');
- }
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $question = $this->_objectManager->create('SymfonyComponentConsoleQuestionConfirmationQuestion', ['question'=>'your question', 'default' => FALSE]);
- echo $ans = $helper->ask($input, $output, $question);
- if ($ans == 'yes') {
- $output->writeln('Hello World!');
- }else{
- $output->writeln('Noooooooo');
- }
- $output->writeln('Done!');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement