Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     $inputOptions = $this->configModel->getAvailableOptions();
     $inputOptions = array_merge($inputOptions, $this->userConfig->getOptionsList());
     $inputOptions = array_merge($inputOptions, $this->adminUser->getOptionsList());
     $inputOptions = array_merge($inputOptions, [new InputOption(self::INPUT_KEY_CLEANUP_DB, null, InputOption::VALUE_NONE, 'Cleanup the database before installation'), new InputOption(self::INPUT_KEY_SALES_ORDER_INCREMENT_PREFIX, null, InputOption::VALUE_REQUIRED, 'Sales order number prefix'), new InputOption(self::INPUT_KEY_USE_SAMPLE_DATA, null, InputOption::VALUE_NONE, 'Use sample data')]);
     $this->setName('setup:install')->setDescription('Installs Magento Application')->setDefinition($inputOptions);
     parent::configure();
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $inputOptions = $input->getOptions();
     $configOptionsToValidate = [];
     foreach ($this->configModel->getAvailableOptions() as $option) {
         if (array_key_exists($option->getName(), $inputOptions)) {
             $configOptionsToValidate[$option->getName()] = $inputOptions[$option->getName()];
         }
     }
     $errors = $this->configModel->validate($configOptionsToValidate);
     $errors = array_merge($errors, $this->adminUser->validate($input));
     $errors = array_merge($errors, $this->validate($input));
     $errors = array_merge($errors, $this->userConfig->validate($input));
     if (!empty($errors)) {
         foreach ($errors as $error) {
             $output->writeln("<error>{$error}</error>");
         }
         throw new \InvalidArgumentException('Parameter validation failed');
     }
 }