MINOR: Made DataObjectSet implement the SS_List interface.

This commit is contained in:
ajshort 2011-05-03 12:16:15 +10:00
parent b872ad7bb8
commit 26faead3e5

View File

@ -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.