Class:SmartestSortableItemReferenceSet

From The Smartest Wiki
Jump to: navigation, search

SmartestSortableItemReferenceSet is a class that contains references (IDs) of one or more items from the same model.

The class is a lightweight way of manipulating (sorting, merging) data before all item info is retrieved.

It is not normally instantiated directly, but is more often returned by other classes such as the SmartestQuery class used in Smartest's Query API.

Important methods

sort($property=default_property, $direction=ASC) - sorts the items referred to in the set by the specified property.


static mergeSeveral(SmartestSortableItemReferenceSet $set1, SmartestSortableItemReferenceSet $set2, [SmartestSortableItemReferenceSet $set3 ...]) - combines the item references in the provided sets and returns a new set with all item references.

$big_set = SmartestSortableItemReferenceSet::merge($set1, $set2, $set3, $set4);
$big_set->sort()


static merge(SmartestSortableItemReferenceSet $set1, SmartestSortableItemReferenceSet $set2) - combines the item references in the two provided sets and returns a new set with all item references:

$big_set = SmartestSortableItemReferenceSet::merge($set1, $set2);
$big_set->sort()


array getIds() - returns the IDs of all items currently held in the set.