/** * Try to bootstrap magento 2 and load cli application */ protected function registerMagentoCoreCommands() { if ($this->getMagentoRootFolder()) { // Magento was found -> register core cli commands require_once $this->getMagentoRootFolder() . '/app/bootstrap.php'; $coreCliApplication = new \Magento\Framework\Console\Cli(); $coreCliApplicationCommands = $coreCliApplication->all(); foreach ($coreCliApplicationCommands as $coreCliApplicationCommand) { $this->add($coreCliApplicationCommand); } } }
/** * Try to bootstrap magento 2 and load cli application * * @param OutputInterface $output */ protected function registerMagentoCoreCommands(OutputInterface $output) { if ($this->getMagentoRootFolder()) { // Magento was found -> register core cli commands require_once $this->getMagentoRootFolder() . '/app/bootstrap.php'; $coreCliApplication = new \Magento\Framework\Console\Cli(); $coreCliApplicationCommands = $coreCliApplication->all(); foreach ($coreCliApplicationCommands as $coreCliApplicationCommand) { if (OutputInterface::VERBOSITY_DEBUG <= $output->getVerbosity()) { $output->writeln(sprintf('<debug>Add core command </debug> <info>%s</info> -> <comment>%s</comment>', $coreCliApplicationCommand->getName(), get_class($coreCliApplicationCommand))); } $this->add($coreCliApplicationCommand); } } }