mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
parent
cdc2182430
commit
05af310e4c
@ -9,12 +9,13 @@ use Icinga\Application\Benchmark;
|
|||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Data\QueryInterface;
|
use Icinga\Data\QueryInterface;
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
|
use Icinga\Data\SortRules;
|
||||||
use Icinga\Exception\QueryException;
|
use Icinga\Exception\QueryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query class supposed to mediate between a repository and its datasource's query
|
* Query class supposed to mediate between a repository and its datasource's query
|
||||||
*/
|
*/
|
||||||
class RepositoryQuery implements QueryInterface, Iterator
|
class RepositoryQuery implements QueryInterface, SortRules, Iterator
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The repository being used
|
* The repository being used
|
||||||
@ -212,6 +213,16 @@ class RepositoryQuery implements QueryInterface, Iterator
|
|||||||
return $this->query->getFilter();
|
return $this->query->getFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the sort rules being applied on this query
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getSortRules()
|
||||||
|
{
|
||||||
|
return $this->repository->getSortRules();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a sort rule for this query
|
* Add a sort rule for this query
|
||||||
*
|
*
|
||||||
@ -226,7 +237,7 @@ class RepositoryQuery implements QueryInterface, Iterator
|
|||||||
*/
|
*/
|
||||||
public function order($field = null, $direction = null, $ignoreDefault = false)
|
public function order($field = null, $direction = null, $ignoreDefault = false)
|
||||||
{
|
{
|
||||||
$sortRules = $this->repository->getSortRules();
|
$sortRules = $this->getSortRules();
|
||||||
if ($field === null) {
|
if ($field === null) {
|
||||||
// Use first available sort rule as default
|
// Use first available sort rule as default
|
||||||
if (empty($sortRules)) {
|
if (empty($sortRules)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user