public function testExport() { $filesystem = new Filesystem(); $exportPrefs = new ExportPrefs(); $exportPrefs->setSideForChoicesNotSet('recolnat'); $exportPrefs->setSideForNewRecords('recolnat'); $this->if($dwcFilePath = $this->exportManager->export('dwc', $exportPrefs))->string($dwcFilePath); $this->boolean($filesystem->exists($dwcFilePath))->isTrue(); }
/** * @param ExportPrefs $exportPrefs * @return array */ private function prepareExport(ExportPrefs $exportPrefs) { $this->exportPrefs = $exportPrefs; $catalogNumbers = $this->sessionManager->get('catalogNumbers'); $datas = $this->genericEntityManager->getEntitiesLinkedToSpecimens($this->exportPrefs->getSideForChoicesNotSet(), $this->collection, $catalogNumbers); $datasWithChoices = $this->getArrayDatasWithChoices($datas); $datasWithChoices = $this->addLonesomesRecords($datasWithChoices); return $datasWithChoices; }
protected function execute(InputInterface $input, OutputInterface $output) { $this->collectionCode = $input->getArgument('collectionCode'); $this->institutionCode = $input->getArgument('institutionCode'); $this->translator = $this->getContainer()->get('translator'); $this->user = $this->getUser($input); $collection = $this->getContainer()->get('utility')->getCollection($this->institutionCode, $this->collectionCode, $this->user); /** @var ExportPrefs $exportPrefs */ $exportPrefs = new ExportPrefs(); $exportPrefs->setSideForNewRecords('recolnat'); $exportPrefs->setSideForChoicesNotSet('recolnat'); if (!$exportPrefs instanceof ExportPrefs) { throw new \Exception('parameters must be an instance of ExportPrefs'); } /* @var $exportManager \AppBundle\Manager\ExportManager */ $exportManager = $this->getContainer()->get('exportmanager')->init($this->user)->setCollection($collection); $file = $exportManager->export($input->getArgument('format'), $exportPrefs); $output->writeln($file); }