silverstripe-framework/model/Sortable.php
Will Rossiter 9938b64cf6 FEATURE: implement SS_Sortable->reverse()
API CHANGE: SQLQuery:: now an array object rather than string. Existing strings will continue to work
2012-04-27 15:54:14 +12:00

39 lines
865 B
PHP

<?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();
/**
* Reverses the list based on reversing the current sort.
*
* @example $list->reverse();
*
* @return array
*/
public function reverse();
}