Exemple #1
0
 /**
  * Fetch IDs until position
  *
  * @param int $position
  */
 protected function fetchIdsUntil(int $position)
 {
     while ($this->fetchPosition <= $position) {
         $this->items[$this->fetchPosition] = $this->getRepository()->createId($this->storageResult->current());
         $this->storageResult->next();
         $this->fetchPosition++;
     }
 }
Exemple #2
0
 /**
  * {@inheritDoc}
  * @see \Fixin\Model\Entity\Cache\CacheInterface::fetchResultEntity($storageResult)
  */
 public function fetchResultEntity(StorageResultInterface $storageResult) : EntityInterface
 {
     $data = $storageResult->current();
     $storageResult->next();
     $entityId = $this->repository->createId(array_intersect_key($data, $this->primaryKeyFlipped));
     $key = (string) $entityId;
     if (isset($this->entities[$key])) {
         return $this->entities[$key];
     }
     if (isset($this->invalidEntities[$key])) {
         $entity = $this->invalidEntities[$key];
         unset($this->invalidEntities[$key]);
         return $this->entities[$key] = $entity->exchangeArray($data);
     }
     return $this->entities[$key] = $this->entityPrototype->withOptions([EntityInterface::OPTION_ENTITY_ID => $entityId])->exchangeArray($data);
 }