whitelistGenerator = $whitelistGenerator; parent::__construct($name); } /** * Initialization of the command. * * @return void */ protected function configure() { $this->setName('setup:db-declaration:generate-whitelist') ->setDescription( 'Generate whitelist of tables and columns that are allowed to be edited by declaration installer' ) ->setDefinition( [ new InputOption( self::MODULE_NAME_KEY, null, InputOption::VALUE_OPTIONAL, 'Name of the module where whitelist will be generated', FileResolverByModule::ALL_MODULES ) ] ); parent::configure(); } /** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) : int { $moduleName = $input->getOption(self::MODULE_NAME_KEY); try { $this->whitelistGenerator->generate($moduleName); } catch (ConfigurationMismatchException $e) { $output->writeln($e->getMessage()); return \Magento\Framework\Console\Cli::RETURN_FAILURE; } catch (\Exception $e) { return \Magento\Framework\Console\Cli::RETURN_FAILURE; } return \Magento\Framework\Console\Cli::RETURN_SUCCESS; } }