Esempio n. 1
0
 /**
  * Return the query, with the paging applied to it.
  * @return String the sql query
  */
 public function getQuery()
 {
     if ($this->paging == null) {
         return $this->sql;
     }
     $search = $this->paging->getSearchInfo();
     if ($search != null && $this->includeFilter) {
         $this->applySearchFilter($search);
     }
     $newSql = "select SQL_CALC_FOUND_ROWS * from (" . $this->sql . ") _x";
     if ($this->paging->getOrderByColumn()) {
         $newSql .= " order by " . $this->paging->getOrderByColumn();
         $newSql .= $this->paging->isOrderByAscending() ? ' asc' : ' desc';
     }
     $newSql .= " limit " . $this->paging->getFirstRecord() . ", " . $this->paging->getRecordsPerPage();
     return $newSql;
 }
Esempio n. 2
0
 /**
  * @covers PagingInfo::getRecordsPerPage
  */
 public function testGetRecordsPerPage()
 {
     $this->paging->setRecordsPerPage(27);
     $this->assertSame(27, $this->paging->getRecordsPerPage());
 }