mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #70 from stojg/ss_list-changes
API CHANGE Childclasses to SS_List matches the same signature on abstract
This commit is contained in:
commit
92e8f6a2f4
@ -155,7 +155,7 @@ class ArrayList extends ViewableData implements SS_List {
|
|||||||
return end($this->items);
|
return end($this->items);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($keyfield, $titlefield) {
|
public function map($keyfield = 'ID', $titlefield = 'Title') {
|
||||||
$map = array();
|
$map = array();
|
||||||
foreach ($this->items as $item) {
|
foreach ($this->items as $item) {
|
||||||
$map[$this->extractValue($item, $keyfield)] = $this->extractValue($item, $titlefield);
|
$map[$this->extractValue($item, $keyfield)] = $this->extractValue($item, $titlefield);
|
||||||
|
@ -67,7 +67,7 @@ interface SS_List extends ArrayAccess, Countable, IteratorAggregate {
|
|||||||
* @param string $titlefield
|
* @param string $titlefield
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function map($keyfield, $titlefield);
|
public function map($keyfield = 'ID', $titlefield = 'Title');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first item in the list where the key field is equal to the
|
* Returns the first item in the list where the key field is equal to the
|
||||||
@ -85,7 +85,7 @@ interface SS_List extends ArrayAccess, Countable, IteratorAggregate {
|
|||||||
* @param string $field
|
* @param string $field
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function column($field);
|
public function column($colName = "ID");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns TRUE if the list can be sorted by a field.
|
* Returns TRUE if the list can be sorted by a field.
|
||||||
|
Loading…
Reference in New Issue
Block a user