Пример #1
0
Файл: Api.php Проект: c15k0/psfs
 /**
  * Add order fields to query
  *
  * @param ModelCriteria $query
  */
 private function addOrders(ModelCriteria &$query)
 {
     $orderAdded = FALSE;
     foreach ($this->order->getOrders() as $field => $direction) {
         if ($this->checkFieldExists($field)) {
             $orderAdded = TRUE;
             if ($direction === Order::ASC) {
                 $query->addAscendingOrderByColumn($field);
             } else {
                 $query->addDescendingOrderByColumn($field);
             }
         }
     }
     if (!$orderAdded) {
         $query->addAscendingOrderByColumn(1);
     }
 }