Sortable deprecated
interface Sortable implements SS_List (View source)
deprecated
Additional interface for SS_List classes that are sortable.
All methods in this interface are immutable - they should return new instances with the sort applied, rather than applying the sort in place
Methods
Adds an item to the list, making no guarantees about where it will appear.
Returns a map of a key field to a value field of all the items in the list.
Returns the first item in the list where the key field is equal to the value.
Details
T[]
toArray()
Returns all the items in the list in an array.
array
toNestedArray()
Returns the contents of the list as an array of maps.
add(mixed $item)
Adds an item to the list, making no guarantees about where it will appear.
remove(mixed $item)
Removes an item from the list.
T|null
first()
Returns the first item in the list.
T|null
last()
Returns the last item in the list.
Map
map(string $keyfield = 'ID', string $titlefield = 'Title')
Returns a map of a key field to a value field of all the items in the list.
T|null
find(string $key, mixed $value)
Returns the first item in the list where the key field is equal to the value.
array
column(string $colName = "ID")
Returns an array of a single field value for all items in the list.
each($callback)
No description
bool
canSortBy(string $by)
Returns TRUE if the list can be sorted by a field.
sort()
No description
reverse()
No description