mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE: Added SS_Sortable, an extra interface to apply to SS_Lists.
This commit is contained in:
parent
f000a47813
commit
e9e7655867
@ -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
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
|
29
model/Sortable.php
Normal file
29
model/Sortable.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Additional interface for {@link SS_List} classes that are sortable.
|
||||
*
|
||||
* @see SS_List, SS_Filterable, SS_Limitable
|
||||
*/
|
||||
interface SS_Sortable {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the list can be sorted by a field.
|
||||
*
|
||||
* @param string $by
|
||||
* @return bool
|
||||
*/
|
||||
public function canSortBy($by);
|
||||
|
||||
/**
|
||||
* Sorts this list by one or more fields. You can either pass in a single
|
||||
* field name and direction, or a map of field names to sort directions.
|
||||
*
|
||||
* @example $list->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();
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user