/** * <p> * Attempts to resolve a reference to an identified object, by the passed * <tt>$id</tt> from the internal data source's index of objects first. If * this data source does not contain the object reference, the data source * will fall back to the populator in an attempt to lookup the object from * other data sources. * </p> * * @param string $name the name identifying the object to look up. * @throws \Exception */ public function getReference($name) { $ref = null; // ** Look for the object first within this data sources. if ($this->contains($name)) { $ref = $this->findObject($name); if ($ref !== null) { return $ref; } } // ** Look for the object within other data sources. $ref = $this->populator->lookup($name); if ($ref === null) { $this->getLog()->debug('Unable to find a object by reference: ' . $name . '. Please check your data sources. ' . 'If the object has already been persisted by another populator use the "query" attribute instead of "ref".'); throw new \NullPointerException('Unable to find reference: ' . $name . '. Does this object exist in your included data sources?'); } return $ref; }
/** * * @param IPopulator $populator * @param InputInterface $input * @param OutputInterface $output */ private function overrideFiles(IPopulator $populator, InputInterface $input, OutputInterface $output) { $option->writeln('Overriding populator files...'); $files = $this->getFilesOverride($input, $output); if ($files !== null) { if ($output->getVerbosity() == OutputInterface::VERBOSITY_VERBOSE) { $option->writeln('Setting populator data source files to: ' . print_r($files)); } $populator->setFiles($files); } }