Example #1
0
 /**
  * @param Select $select
  * @return array
  */
 public function getElementsCount(Select $select)
 {
     $select->setLimit(null);
     $select->setOffset(null);
     $select->setColumns(array('COUNT(*)'));
     $db = new DbGateway();
     return $db->execute($select, \PDO::FETCH_COLUMN);
 }
 public function getList()
 {
     $select = new Select();
     $select->setFrom('search_institutions');
     $select->addColumn('search_institutions.*');
     $select->addColumn('sum/count as rate');
     $select->addOrderBy('rate desc');
     $select->setLimit(10);
     $paginator = new Paginator();
     $db = new DbGateway();
     return array('count' => $paginator->getElementsCount($select), 'data' => $db->execute($select));
 }