You are here

public function RestfulDataProviderDbQuery::defaultSortInfo in RESTful 7

Defines default sort columns if none are provided via the request URL.

Return value

array Array keyed by the database column name, and the order ('ASC' or 'DESC') as value.

1 call to RestfulDataProviderDbQuery::defaultSortInfo()
RestfulDataProviderDbQuery::queryForListSort in plugins/restful/RestfulDataProviderDbQuery.php
Sort the query for list.

File

plugins/restful/RestfulDataProviderDbQuery.php, line 125
Contains \RestfulDataProviderDbQuery

Class

RestfulDataProviderDbQuery
@file Contains \RestfulDataProviderDbQuery

Code

public function defaultSortInfo() {
  $sorts = array();
  foreach ($this
    ->getIdColumn() as $column) {
    if (!empty($this->getPublicFields[$column])) {

      // Sort by the first ID column that is a public field.
      $sorts[$column] = 'ASC';
      break;
    }
  }
  return $sorts;
}