protected function execute(
        \Symfony\Component\Console\Input\InputInterface $input,
        \Symfony\Component\Console\Output\OutputInterface $output
    ) {
        /* save console output locally (command context) */
        $this->out = $output;
        $this->logInfo("Command '" . $this->getName() . "' is started.");
        $this->conn->beginTransaction();
        try {
            $this->checkAreaCode();
            /* all children must implement 'process' method */
            $this->process($input);
            $this->conn->commit();
        } catch (\Throwable $e) {
            $this->logError("Command '" . $this->getName() . "' failed. Reason: " . $e->getMessage());
            $this->conn->rollBack();
        }
        $this->logInfo("Command '" . $this->getName() . "' is completed.");
    }
protected function execute(
        \Symfony\Component\Console\Input\InputInterface $input,
        \Symfony\Component\Console\Output\OutputInterface $output
    ) {
        /* save console output locally (command context) */
        $this->out = $output;
        $this->logInfo("Command '" . $this->getName() . "' is started.");
        $this->conn->beginTransaction();
        try {
            $this->checkAreaCode();
            /* all children must implement 'process' method */
            $this->process($input);
            $this->conn->commit();
        } catch (\Throwable $e) {
            $this->logError("Command '" . $this->getName() . "' failed. Reason: " . $e->getMessage());
            $this->conn->rollBack();
        }
        $this->logInfo("Command '" . $this->getName() . "' is completed.");
    }
protected function execute ( \ Symfony \ Component \ Console \ Input \ InputInterface $ input , \ Symfony \ Component \ Console \ Output \ OutputInterface $ output ) { /* save console output locally (command context) */ $ this -> out = $ output ; $ this -> logInfo ( "Command '" . $ this -> getName ( ) . "' is started." ) ; $ this -> conn -> beginTransaction ( ) ; try { $ this -> checkAreaCode ( ) ; /* all children must implement 'process' method */ $ this -> process ( $ input ) ; $ this -> conn -> commit ( ) ; } catch ( \ Throwable $ e ) { $ this -> logError ( "Command '" . $ this -> getName ( ) . "' failed. Reason: " . $ e -> getMessage ( ) ) ; $ this -> conn -> rollBack ( ) ; } $ this -> logInfo ( "Command '" . $ this -> getName ( ) . "' is completed." ) ; }
Wrap main process function with try-catch & transaction.

@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return int|void|null
Wrap main process function with try - catch & transaction .