SS_Sortable
interface SS_Sortable implements SS_List
Additional interface for {@link 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.
Returns an array of a single field value for all items in the list.
Returns TRUE if the list can be sorted by a field.
Return a new instance of this list that is sorted 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.
Return a new instance of this list based on reversing the current sort.
Details
in SS_List at line 15
array
toArray()
Returns all the items in the list in an array.
in SS_List at line 22
array
toNestedArray()
Returns the contents of the list as an array of maps.
in SS_List at line 30
add(mixed $item)
Adds an item to the list, making no guarantees about where it will appear.
in SS_List at line 37
remove(mixed $item)
Removes an item from the list.
in SS_List at line 44
mixed
first()
Returns the first item in the list.
in SS_List at line 51
mixed
last()
Returns the last item in the list.
in SS_List at line 61
array
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.
in SS_List at line 71
mixed
find(string $key, mixed $value)
Returns the first item in the list where the key field is equal to the value.
in SS_List at line 79
array
column(string $colName = "ID")
Returns an array of a single field value for all items in the list.
in SS_List at line 87
mixed
each(callable $callback)
Walks the list using the specified callback
at line 21
bool
canSortBy(string $by)
Returns TRUE if the list can be sorted by a field.
at line 33
SS_Sortable
sort()
Return a new instance of this list that is sorted 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.
at line 42
SS_Sortable
reverse()
Return a new instance of this list based on reversing the current sort.