/**
  *
  * @param OutputInterface $output
  * @param ProfileEntity $profileModel
  * @param string $file
  * @param string $format
  */
 protected function start(OutputInterface $output, $profileModel, $file, $format)
 {
     $helper = new CommandHelper(array('profileEntity' => $profileModel, 'filePath' => $file, 'format' => $format, 'username' => 'Commandline'));
     $output->writeln('<info>' . sprintf("Using profile: %s.", $profileModel->getName()) . '</info>');
     $output->writeln('<info>' . sprintf("Using format: %s.", $format) . '</info>');
     $output->writeln('<info>' . sprintf("Using file: %s.", $file) . '</info>');
     $return = $helper->prepareImport();
     $count = $return['count'];
     $output->writeln('<info>' . sprintf("Total count: %d.", $count) . '</info>');
     $return = $helper->importAction();
     $position = $return['data']['position'];
     $output->writeln('<info>' . sprintf("Processed: %d.", $position) . '</info>');
     while ($position < $count) {
         $return = $helper->importAction();
         $position = $return['data']['position'];
         $output->writeln('<info>' . sprintf("Processed: %d.", $position) . '</info>');
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Validation of user input
     $this->prepareExportInputValidation($input);
     $this->registerErrorHandler($output);
     $helper = new CommandHelper(array('profileEntity' => $this->profileEntity, 'filePath' => Shopware()->DocPath() . $this->filePath, 'format' => $this->format, 'exportVariants' => $this->exportVariants, 'limit' => $this->limit, 'offset' => $this->offset, 'username' => 'Commandline', 'category' => $this->category ? array($this->category) : null));
     $output->writeln('<info>' . sprintf("Using profile: %s.", $this->profile) . '</info>');
     $output->writeln('<info>' . sprintf("Using format: %s.", $this->format) . '</info>');
     $output->writeln('<info>' . sprintf("Using file: %s.", $this->filePath) . '</info>');
     if ($this->category) {
         $output->writeln('<info>' . sprintf("Using category as filter: %s.", $this->category) . '</info>');
     }
     $return = $helper->prepareExport();
     $count = $return['count'];
     $output->writeln('<info>' . sprintf("Total count: %d.", $count) . '</info>');
     $data = $helper->exportAction();
     $position = $data['position'];
     $output->writeln('<info>' . sprintf("Processed: %d.", $position) . '</info>');
     while ($position < $count) {
         $data = $helper->exportAction();
         $position = $data['position'];
         $output->writeln('<info>' . sprintf("Processed: %d.", $position) . '</info>');
     }
 }
 /**
  * @param bool|Profile $profileModel
  * @param string $inputFile
  * @param string $format
  * @return array
  */
 protected function start($profileModel, $inputFile, $format)
 {
     $commandHelper = new CommandHelper(['profileEntity' => $profileModel, 'filePath' => $inputFile, 'format' => $format, 'username' => 'Cron']);
     $return = $commandHelper->prepareImport();
     $count = $return['count'];
     $return = $commandHelper->importAction();
     $position = $return['data']['position'];
     while ($position < $count) {
         $return = $commandHelper->importAction();
         $position = $return['data']['position'];
     }
     return $return;
 }