/**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $adminUserName = $input->getArgument(AdminAccount::KEY_USER);
     $modules = [];
     if ($input->getOption(self::INPUT_KEY_MODULES)) {
         $modules = $this->getRequestedModules($input->getOption(self::INPUT_KEY_MODULES));
     }
     $logger = new ConsoleLogger($output);
     $this->sampleData->install($this->objectManager, $logger, $adminUserName, $modules);
     $output->writeln('<info>' . 'Successfully installed sample data.' . '</info>');
 }
 /**
  * Run installation process for Sample Data
  *
  * @param array $request
  * @return void
  *
  * @SuppressWarnings(PHPMD.UnusedPrivateMethod) Called by install() via callback.
  */
 private function installSampleData($request)
 {
     $userName = isset($request[AdminAccount::KEY_USERNAME]) ? $request[AdminAccount::KEY_USERNAME] : '';
     $this->sampleData->install($this->objectManagerProvider->get(), $this->log, $userName);
 }
Exemple #3
0
 /**
  * Run installation process for Sample Data
  *
  * @param array $request
  * @return void
  * @throws \Magento\Setup\SampleDataException
  *
  * @SuppressWarnings(PHPMD.UnusedPrivateMethod) Called by install() via callback.
  */
 private function installSampleData($request)
 {
     try {
         $userName = isset($request[AdminAccount::KEY_USER]) ? $request[AdminAccount::KEY_USER] : '';
         $this->objectManagerProvider->reset();
         $this->sampleData->install($this->objectManagerProvider->get(), $this->log, $userName);
     } catch (\Exception $e) {
         throw new \Magento\Setup\SampleDataException(
             "Error during sample data installation: {$e->getMessage()}",
             $e->getCode()
         );
     }
 }