$itemStack
$itemStack :
merge(object $collection, string $sort = false, boolean $sortFlag = false) : object
Merges two collections together. If you pass a second argument it attempts to sort it via that property (both models must have that property).
> $coll->merge($other, 'foo', \foundry\collection\SORT_REVERSE);
| object | $collection | the other collection |
| string | $sort | property to sort by |
| boolean | $sortFlag | set to SORT_REVERSE to sort... in reverse |
foundry\collection
splat(string $property, string $key = false) : array
Flattens the collection into a single property array This is useful for returning elements for an auto complete search system implemented via AJAX
$authors = _M( 'authors' )->find( ... );
return $authors->splat( 'name' );
// returns array( 'Author One', 'Author Two' );
return $authors->splat('name', 'uid');
// array( '1234' => 'Author One', '5678' => 'Author Two');
| string | $property | property to extract |
| string | $key | return array as k->v pair |
grab(string $prop, mixed $val, boolean $greedy = false) : object
Grab all the models whose property matches the passed value
$authors = $allAuthors->grab('status', 1);
// grabs all the objects with a status of '1'
| string | $prop | property to check |
| mixed | $val | value to test against |
| boolean | $greedy | if TRUE, matched objects are removed from the stack |
foundry\model\collection