Example #1
0
 /**
  * Fetches the results
  * @return null|QueryResults|string
  */
 public function fetch()
 {
     $this->fetchQuery($this->params);
     if (!is_null($this->internalFetchQuery)) {
         if (isset($this->params["limit"])) {
             /* get the limit of results */
             $limit = $this->params["limit"];
             /* if they are valid */
             if ($limit > 0) {
                 if (!isset($this->params["page"]) || !($this->params["page"] > 0)) {
                     $page = 1;
                 } else {
                     $page = $this->params["page"];
                 }
                 /* limit the actual query */
                 $this->internalFetchQuery->limit($limit)->offset($limit * ($page - 1));
             }
         }
         return parent::runFetch();
     } else {
         return null;
     }
 }