src/BaseCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var MessageInterface $message */
        $message = $this->getContainer()->get($this->serviceAlias);

        if (get_class($message) !== $this->serviceClass) {
            throw new InvalidArgumentException(sprintf(
                'The specified service alias (%s) and class (%s) do not correspond to each other.',
                $this->serviceAlias,
                $this->serviceClass
            ));
        }

        $message->setCliCommand($this);
        $message->setInput($input);
        $message->setOutput($output);
        $this->getCommandBus()->handle($message);
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var MessageInterface $message */
        $message = $this->getContainer()->get($this->serviceAlias);

        if (get_class($message) !== $this->serviceClass) {
            throw new InvalidArgumentException(sprintf(
                'The specified service alias (%s) and class (%s) do not correspond to each other.',
                $this->serviceAlias,
                $this->serviceClass
            ));
        }

        $message->setCliCommand($this);
        $message->setInput($input);
        $message->setOutput($output);
        $this->getCommandBus()->handle($message);
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { /** @var MessageInterface $message */ $ message = $ this -> getContainer ( ) -> get ( $ this -> serviceAlias ) ; if ( get_class ( $ message ) !== $ this -> serviceClass ) { throw new InvalidArgumentException ( sprintf ( 'The specified service alias (%s) and class (%s) do not correspond to each other.' , $ this -> serviceAlias , $ this -> serviceClass ) ) ; } $ message -> setCliCommand ( $ this ) ; $ message -> setInput ( $ input ) ; $ message -> setOutput ( $ output ) ; $ this -> getCommandBus ( ) -> handle ( $ message ) ; }
Executes the current command by retrieving its associated Message from the Container, setting the Input and
Output according to what was received as parameters, and finally passing that Message to the CommandBus for
handling.

@param InputInterface $input An InputInterface instance
@param OutputInterface $output An OutputInterface instance

@return int|null null or 0 if everything went fine, or an error code

@throws InvalidArgumentException
Executes the current command by retrieving its associated Message from the Container setting the Input and Output according to what was received as parameters and finally passing that Message to the CommandBus for handling .