Example #1
0
 public function all(SelectStatement $select, $indexes = array())
 {
     $result = $this->fetchAll($select);
     $entityClass = $select->entity();
     $cleanEntity = new $entityClass();
     $pkDefinition = $cleanEntity->pkDefinition();
     $collection = new Collection();
     $collection->source($select->source());
     $collection->entity($entityClass)->data($result);
     if (!isset($indexes['PRIMARY'])) {
         $indexes['PRIMARY'] = $pkDefinition;
     }
     $collection->indexes($indexes);
     return $collection;
 }