From e5e3dc9c43514b6fc39507f88aad18e6426af6f6 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 15 Apr 2014 16:07:27 +0200 Subject: [PATCH] Add interface "Sortable" defining how a result set can be sorted This interface should be used to ensure that sorting a result set is standardized among the different query implementations. --- library/Icinga/Data/Sortable.php | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 library/Icinga/Data/Sortable.php diff --git a/library/Icinga/Data/Sortable.php b/library/Icinga/Data/Sortable.php new file mode 100644 index 000000000..73dab5ecf --- /dev/null +++ b/library/Icinga/Data/Sortable.php @@ -0,0 +1,48 @@ + + * $query->order('field, 'ASC') + * + * + * @param string $field + * @param int $direction + * + * @return self + */ + public function order($field, $direction = null); + + /** + * Whether an order is set + * + * @return bool + */ + public function hasOrder(); + + /** + * Get the order if any + * + * @return array|null + */ + public function getOrder(); +}