Beispiel #1
0
 /**
  * Returns entry from specific position.
  * @param int
  * @return IEntity|NULL
  */
 public function get($position)
 {
     if (isset($this->cachedResult[$position])) {
         $entity = $this->cachedResult[$position];
         if ($entity === false) {
             return NULL;
         }
         return $entity;
     }
     if ($this->currentPosition !== $position) {
         if ($this->resultSeek($position)) {
             $this->currentPosition = $position;
         } else {
             $this->currentPosition = -1;
             $this->cachedResult[$position] = false;
             return NULL;
         }
     }
     $row = $this->resultFetch();
     if ($row === false) {
         $this->currentPosition = -1;
         $this->cachedResult[$position] = false;
         return NULL;
     } else {
         $this->currentPosition++;
         $entity = $this->repository->hydrateEntity($row);
         $this->cachedResult[$position] = $entity;
         return $entity;
     }
 }
Beispiel #2
0
 /** @return IEntity */
 public function current()
 {
     return $this->repository->hydrateEntity(parent::current());
 }