public function importSnippets()
 {
     $dump = $this->container->get('dump');
     if (!$dump) {
         $result = new FinishResult(0, 0);
         $this->toJson(200, $this->resultMapper->toExtJs($result));
         return;
     }
     $conn = $this->container->get('db');
     $snippetStep = new SnippetStep($conn, $dump);
     $offset = $this->request->get('offset');
     $result = $snippetStep->run($offset);
     $this->toJson(200, $this->resultMapper->toExtJs($result));
 }
 private function importSnippets()
 {
     $this->IOHelper->writeln("Import snippets...");
     /** @var DumpIterator $dump */
     $dump = $this->container->get('dump');
     if (!$dump) {
         $this->IOHelper->writeln("skipped...");
         return 1;
     }
     /** @var \PDO $conn */
     $conn = $this->container->get('db');
     $snippetStep = new SnippetStep($conn, $dump);
     $progress = $this->IOHelper->createProgressBar($dump->count());
     $progress->start();
     $offset = 0;
     do {
         $progress->setCurrent($offset);
         $result = $snippetStep->run($offset);
         if ($result instanceof ErrorResult) {
             throw new \Exception($result->getMessage(), 0, $result->getException());
         }
         $offset = $result->getOffset();
         $progress->setCurrent($offset);
     } while ($result instanceof ValidResult);
     $progress->finish();
     $this->IOHelper->writeln("");
 }
 public function importSnippets()
 {
     $this->output->writeln("Import snippets...");
     /** @var Dump $dump */
     $dump = $this->container->get('dump');
     if (!$dump) {
         $this->output->writeln("skipped...");
         return 1;
     }
     /** @var \PDO $conn */
     $conn = $this->container->get('db');
     $this->output->writeln("Importing snippets");
     $snippetStep = new SnippetStep($conn, $dump);
     /** @var ProgressHelper $progress */
     $progress = $this->getHelperSet()->get('progress');
     $progress->start($this->output, $dump->count());
     $offset = 0;
     do {
         $progress->setCurrent($offset);
         $result = $snippetStep->run($offset);
         if ($result instanceof ErrorResult) {
             throw new \Exception($result->getMessage(), 0, $result->getException());
         }
         $offset = $result->getOffset();
         $progress->setCurrent($offset);
     } while ($result instanceof ValidResult);
     $progress->finish();
 }