class SS_Map implements ArrayAccess, Countable, IteratorAggregate

Creates a map from an SS_List by defining a key column and a value column.

Methods

__construct(SS_List $list, $keyField = "ID", $valueField = "Title")

Construct a new map around an SS_list.

setKeyField($keyField)

Set the key field for this map.

setValueField($valueField)

Set the value field for this map.

array
toArray()

Return an array equivalent to this map.

array
keys()

Return all the keys of this map.

array
values()

Return all the values of this map.

unshift($key, $value)

Unshift an item onto the start of the map.

push($key, $value)

Pushes an item onto the end of the map.

boolean
offsetExists($key)

No description

mixed
offsetGet($key)

No description

offsetSet($key, $value)

Sets a value in the map by a given key that has been set via {@link SS_Map::push()} or {@link SS_Map::unshift()}

offsetUnset($key)

Removes a value in the map by a given key which has been added to the map via {@link SS_Map::push()} or {@link SS_Map::unshift()}

getIterator()

Returns an SS_Map_Iterator instance for iterating over the complete set of items in the map.

int
count()

Returns the count of items in the list including the additional items set through {@link SS_Map::push()} and {@link SS_Map::unshift}.

Details

at line 34
__construct(SS_List $list, $keyField = "ID", $valueField = "Title")

Construct a new map around an SS_list.

Parameters

SS_List $list The list to build a map from
$keyField The field to use as the key of each map entry
$valueField The field to use as the value of each map entry

at line 45
setKeyField($keyField)

Set the key field for this map.

Parameters

$keyField

at line 54
setValueField($valueField)

Set the value field for this map.

Parameters

$valueField

at line 63
array toArray()

Return an array equivalent to this map.

Return Value

array

at line 78
array keys()

Return all the keys of this map.

Return Value

array

at line 87
array values()

Return all the values of this map.

Return Value

array

at line 99
unshift($key, $value)

Unshift an item onto the start of the map.

Stores the value in addition to the {@link DataQuery} for the map.

Parameters

$key
$value

at line 118
push($key, $value)

Pushes an item onto the end of the map.

Parameters

$key
$value

at line 139
boolean offsetExists($key)

Parameters

$key

Return Value

boolean

at line 158
mixed offsetGet($key)

Parameters

$key

Return Value

mixed

at line 189
offsetSet($key, $value)

Sets a value in the map by a given key that has been set via {@link SS_Map::push()} or {@link SS_Map::unshift()}

Keys in the map cannot be set since these values are derived from a {@link DataQuery} instance. In this case, use {@link SS_Map::toArray()} and manipulate the resulting array.

Parameters

$key
$value

at line 215
offsetUnset($key)

Removes a value in the map by a given key which has been added to the map via {@link SS_Map::push()} or {@link SS_Map::unshift()}

Keys in the map cannot be unset since these values are derived from a {@link DataQuery} instance. In this case, use {@link SS_Map::toArray()} and manipulate the resulting array.

Parameters

$key

at line 242
SS_Map_Iterator getIterator()

Returns an SS_Map_Iterator instance for iterating over the complete set of items in the map.

Satisfies the IteratorAggreagte interface.

Return Value

SS_Map_Iterator

at line 258
int count()

Returns the count of items in the list including the additional items set through {@link SS_Map::push()} and {@link SS_Map::unshift}.

Return Value

int