registerCommands example

 catch (Exception $e) {
            $this->kernel->boot(true);
            $formatter = $this->getHelperSet()->get('formatter');
            $output->writeln($formatter->formatBlock('WARNING! ' . $e->getMessage() . ' in ' . $e->getFile(), 'error'));
            $this->skipDatabase = true;
        }

        if (!$this->commandsRegistered) {
            $this->setCommandLoader($this->kernel->getContainer()->get('console.command_loader'));

            if (!\in_array($input->getFirstArgument(), self::IMPORTANT_COMMANDS, true)) {
                $this->registerCommands($output);
            }

            $this->commandsRegistered = true;
        }

        return parent::doRun($input$output);
    }

    /** * {@inheritdoc} */
    
$this->kernel->getContainer()->get('services_resetter')->reset();
        }
    }

    /** * Runs the current application. * * @return int 0 if everything went fine, or an error code */
    public function doRun(InputInterface $input, OutputInterface $output): int
    {
        $this->registerCommands();

        if ($this->registrationErrors) {
            $this->renderRegistrationErrors($input$output);
        }

        $this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));

        return parent::doRun($input$output);
    }

    protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output): int
    {
Home | Imprint | This part of the site doesn't use cookies.