mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: Made DataObjectSet implement the SS_List interface.
This commit is contained in:
parent
b872ad7bb8
commit
26faead3e5
@ -5,7 +5,7 @@
|
|||||||
* @package sapphire
|
* @package sapphire
|
||||||
* @subpackage model
|
* @subpackage model
|
||||||
*/
|
*/
|
||||||
class DataObjectSet extends ViewableData implements IteratorAggregate, Countable, ArrayAccess {
|
class DataObjectSet extends ViewableData implements SS_List {
|
||||||
/**
|
/**
|
||||||
* The DataObjects in this set.
|
* The DataObjects in this set.
|
||||||
* @var array
|
* @var array
|
||||||
@ -165,6 +165,10 @@ class DataObjectSet extends ViewableData implements IteratorAggregate, Countable
|
|||||||
return $this->map($index, $titleField, $emptyString, $sort);
|
return $this->map($index, $titleField, $emptyString, $sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function add($item) {
|
||||||
|
$this->push($item);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an item to the DataObject Set.
|
* Add an item to the DataObject Set.
|
||||||
* @param DataObject $item Item to add.
|
* @param DataObject $item Item to add.
|
||||||
@ -529,6 +533,10 @@ class DataObjectSet extends ViewableData implements IteratorAggregate, Countable
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canSortBy($by) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the current DataObjectSet instance.
|
* Sorts the current DataObjectSet instance.
|
||||||
* @param string $fieldname The name of the field on the DataObject that you wish to sort the set by.
|
* @param string $fieldname The name of the field on the DataObject that you wish to sort the set by.
|
||||||
|
Loading…
Reference in New Issue
Block a user