Example #1
0
 /**
 	/* (non-PHPdoc)
 * @see \vxPHP\Orm\Query::selectFromTo()
 * @return Article[]
 * @throws \RangeException
 */
 public function selectFromTo($from, $to)
 {
     if (empty($this->columnSorts)) {
         throw new \RangeException("'" . __METHOD__ . "' requires a SORT criteria.");
     }
     if ($to < $from) {
         throw new \RangeException("'to' value is less than 'from' value.");
     }
     $this->buildQueryString();
     $this->buildValuesArray();
     $this->sql .= ' LIMIT ' . (int) $from . ', ' . ($to - $from + 1);
     $ids = array();
     foreach ($this->executeQuery() as $row) {
         $ids[] = $row['articlesID'];
     }
     return Article::getInstances($ids);
 }