Esempio n. 1
0
 /**
  * Start or rewind the iteration
  */
 public function rewind()
 {
     if ($this->iterator === null) {
         if (!$this->hasOrder()) {
             $this->order();
         }
         $iterator = $this->repository->getDataSource()->query($this->query);
         if ($iterator instanceof IteratorAggregate) {
             $this->iterator = $iterator->getIterator();
         } else {
             $this->iterator = $iterator;
         }
     }
     $this->iterator->rewind();
     Benchmark::measure('Query result iteration started');
 }
Esempio n. 2
0
 /**
  * {@inheritDoc}
  *
  * @return  Config
  */
 public function getDataSource($table = null)
 {
     if ($this->ds !== null) {
         return parent::getDataSource($table);
     }
     $table = $table ?: $this->getBaseTable();
     $configs = $this->getConfigs();
     if (!isset($configs[$table])) {
         throw new ProgrammingError('Config for table "%s" missing', $table);
     } elseif (!$configs[$table] instanceof Config) {
         $configs[$table] = $this->createConfig($configs[$table], $table);
     }
     if (!$configs[$table]->getConfigObject()->getKeyColumn()) {
         throw new ProgrammingError('INI repositories require their data source to provide a valid key column');
     }
     return $configs[$table];
 }