protected function DataProviderDbQuery::queryForListSort in RESTful 7.2
Sort the query for list.
Parameters
\SelectQuery $query: The query object.
Throws
See also
\RestfulEntityBase::getQueryForList
1 call to DataProviderDbQuery::queryForListSort()
- DataProviderDbQuery::getQueryForList in src/
Plugin/ resource/ DataProvider/ DataProviderDbQuery.php
File
- src/
Plugin/ resource/ DataProvider/ DataProviderDbQuery.php, line 410 - Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderDbQuery.
Class
Namespace
Drupal\restful\Plugin\resource\DataProviderCode
protected function queryForListSort(\SelectQuery $query) {
// Get the sorting options from the request object.
$sorts = $this
->parseRequestForListSort();
$sorts = $sorts ? $sorts : $this
->defaultSortInfo();
foreach ($sorts as $sort => $direction) {
/* @var ResourceFieldDbColumnInterface $sort_field */
if ($sort_field = $this->fieldDefinitions
->get($sort)) {
$query
->orderBy($sort_field
->getColumnForQuery(), $direction);
}
}
}