Esempio n. 1
0
 /**
  * @param DibiConnection
  * @param IRepository
  */
 public function __construct(DibiConnection $connection, IRepository $repository)
 {
     $this->repository = $repository;
     $this->connection = $connection;
     $this->mapper = $repository->getMapper();
     $this->conventional = $this->mapper->getConventional();
 }
Esempio n. 2
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;
     }
 }
Esempio n. 3
0
 /** @return IEntity */
 public function current()
 {
     return $this->repository->hydrateEntity(parent::current());
 }
Esempio n. 4
0
 /** @return IRepositoryContainer */
 public final function getModel()
 {
     return $this->repository->getModel();
 }