recordHelper = $recordHelper; $this->container = $container; $this->structureKey = $structureKey; $this->thesaurusKey = $thesaurusKey; } /** * @param \databox $databox * @param FetcherDelegateInterface $fetcherDelegate * @return Fetcher */ public function createFetcher(\databox $databox, FetcherDelegateInterface $fetcherDelegate = null) { $connection = $databox->get_connection(); $candidateTerms = new CandidateTerms($databox); $fetcher = new Fetcher($databox, array( new CoreHydrator($databox->get_sbas_id(), $databox->get_viewname(), $this->recordHelper), new TitleHydrator($connection), new MetadataHydrator($connection, $this->getStructure(), $this->recordHelper), new FlagHydrator($this->getStructure(), $databox), new ThesaurusHydrator($this->getStructure(), $this->getThesaurus(), $candidateTerms), new SubDefinitionHydrator($connection) ), $fetcherDelegate); $fetcher->setBatchSize(200); $fetcher->onDrain(function() use ($candidateTerms) { $candidateTerms->save(); }); return $fetcher; } /** * @return Structure */ private function getStructure() { return $this->container[$this->structureKey]; } /** * @return Thesaurus */ private function getThesaurus() { return $this->container[$this->thesaurusKey]; } }