protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configurationBuilder = new EntityStoreFromConfigurationBuilder();
     $store = $configurationBuilder->buildEntityStore($input->getArgument('configuration'));
     $output->writeln('Import data.');
     $entitySaver = $store->getEntityDocumentSaver();
     $dumpReader = new IncrementalXmlDumpReader($input->getArgument('file'), new SerializedEntityDeserializer(new EntityIdDeserializer(new BasicEntityIdParser())), new ConsoleLogger($output));
     $count = 0;
     foreach ($dumpReader as $entity) {
         $entitySaver->saveEntityDocument($entity);
         $count++;
         if ($count % 1000 === 0) {
             $output->write('.');
         }
     }
     $output->writeln('Importation done.');
 }
示例#2
0
 private function getEntityStoreFromConfiguration()
 {
     $configBuilder = new EntityStoreFromConfigurationBuilder();
     return $configBuilder->buildEntityStore(__DIR__ . '/../data/valid-config-api.json');
 }