From e9e7655867152d55fc3d83635cc427b25f0d895a Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 9 Mar 2012 14:28:14 +1300 Subject: [PATCH] API CHANGE: Added SS_Sortable, an extra interface to apply to SS_Lists. --- model/ArrayList.php | 2 +- model/DataList.php | 2 +- model/ListDecorator.php | 2 +- model/Sortable.php | 29 +++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 model/Sortable.php diff --git a/model/ArrayList.php b/model/ArrayList.php index 1de211f40..fe7bd91f2 100644 --- a/model/ArrayList.php +++ b/model/ArrayList.php @@ -5,7 +5,7 @@ * @package sapphire * @subpackage model */ -class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Limitable { +class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sortable, SS_Limitable { /** * Holds the items in the list diff --git a/model/DataList.php b/model/DataList.php index bb9e2bfa4..92af851e1 100644 --- a/model/DataList.php +++ b/model/DataList.php @@ -6,7 +6,7 @@ * @package sapphire * @subpackage model */ -class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Limitable { +class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortable, SS_Limitable { /** * The DataObject class name that this data list is querying * diff --git a/model/ListDecorator.php b/model/ListDecorator.php index 46efb202b..53da6a0a0 100644 --- a/model/ListDecorator.php +++ b/model/ListDecorator.php @@ -7,7 +7,7 @@ * @package sapphire * @subpackage model */ -abstract class SS_ListDecorator extends ViewableData implements SS_List, SS_Filterable, SS_Limitable { +abstract class SS_ListDecorator extends ViewableData implements SS_List, SS_Sortable, SS_Filterable, SS_Limitable { protected $list; diff --git a/model/Sortable.php b/model/Sortable.php new file mode 100644 index 000000000..e916f3529 --- /dev/null +++ b/model/Sortable.php @@ -0,0 +1,29 @@ +sort('Name'); // default ASC sorting + * @example $list->sort('Name DESC'); // DESC sorting + * @example $list->sort('Name', 'ASC'); + * @example $list->sort(array('Name'=>'ASC,'Age'=>'DESC')); + */ + public function sort(); + +} \ No newline at end of file