/** * Execute query and return a result iterator. * * @return ResultIterator */ public function execute() { $storage = $this->em->unwrap(); if (!$storage instanceof RangeQueryStorage) { throw new \RuntimeException("The storage backend " . $this->storage->getName() . " does not support range queries."); } $uow = $this->em->getUnitOfWork(); $class = $this->em->getClassMetadata($this->className); return $storage->executeRangeQuery($this, $class->storageName, $class->identifier, function ($row) use($uow, $class) { $key = array(); foreach ($class->identifier as $id) { $key[$id] = $row[$id]; } return $uow->createEntity($class, $key, $row); }); }
/** * @covers ::execute */ public function testWrongExecute() { $this->entityManager->method('unwrap')->willReturn(new DoctrineCacheStorage(new ArrayCache())); $this->setExpectedException(RuntimeException::class); $this->object->execute(); }