/** * creates a mapped job from another (basically clones it) * * @param JobInterface $job the job to clone * @param string $mappedClass FQCN of the entity to map the result to * * @return self */ public static function createFrom(JobInterface $job, $mappedClass, RepositoryFactoryInterface $repositoryFactory = null) { $mappedJob = new MappedJob($job->getServiceName(), $job->getRequest(), $mappedClass); $mappedJob->setMethod($job->getMethod()); $mappedJob->setBody($job->getBody()); if (null !== $repositoryFactory) { $mappedJob->setEntityRepository($repositoryFactory->getRepositoryForEntity($mappedClass)); } return $mappedJob; }
public function runSingleGetRequest($serviceName, $request, $mappedClass) { // run hydra $job = new GetJob($serviceName, $request); if (!empty($mappedClass)) { $job = MappedJob::createFrom($job, $mappedClass, $this->repositoryFactory); } $this->hydra->add($job); $this->hydra->run(); return $job->getResult(); }