|
| __construct (Closure $finder=null, array $options=null, SimpleORMap $record=null) |
|
| offsetSet ($index, $newval) |
|
| setClassName ($class_name) |
|
| setRelatedRecord (SimpleORMap $record) |
|
| getClassName () |
|
| refresh () |
|
| find ($value) |
|
| toGroupedArray ($group_by='id', $only_these_fields=null, callable $group_func=null) |
|
| unsetByPk ($id) |
|
| merge (SimpleCollection $a_collection, string $mode='ignore') |
|
| __construct ($data=[]) |
|
| exchangeArray ($input) |
|
| toArray () |
|
| append ($newval) |
|
| offsetSet ($index, $newval) |
|
| offsetUnset ($index) |
|
| setFinder (callable $finder) |
|
| getDeleted () |
|
| refresh () |
|
| findBy ($key, $values, $op='==') |
|
| findOneBy ($key, $values, $op='==') |
|
| each (callable $func) |
|
| map (callable $func) |
|
| filter (callable $func=null, $limit=null) |
|
| any (callable $func) |
|
| every (callable $func) |
|
| pluck ($columns) |
|
| toGroupedArray ($group_by='id', $only_these_fields=null, callable $group_func=null) |
|
| first () |
|
| last () |
|
| val ($key) |
|
| unsetBy ($key, $values, $op='==') |
|
| orderBy ($order, $sort_flags=SORT_LOCALE_STRING) |
|
| limit ($arg1, $arg2=null) |
|
| sendMessage ($method, $params=[]) |
|
| __call ($method, $params) |
|
| merge (SimpleCollection $a_collection) |
|
| __construct ($input=[], $flags=self::STD_PROP_LIST, $iteratorClass='ArrayIterator') |
|
| __isset ($key) |
|
| __set ($key, $value) |
|
| __unset ($key) |
|
| __get ($key) |
|
| __serialize () |
|
| __unserialize (array $data) |
|
| append ($value) |
|
| asort () |
|
| count () |
|
| exchangeArray ($data) |
|
| getArrayCopy () |
|
| getFlags () |
|
| getIterator () |
|
| getIteratorClass () |
|
| ksort () |
|
| natcasesort () |
|
| natsort () |
|
| offsetExists ($key) |
|
| offsetGet ($key) |
|
| offsetSet ($key, $value) |
|
| offsetUnset ($key) |
|
| setFlags ($flags) |
|
| setIteratorClass ($class) |
|
| uasort ($function) |
|
| uksort ($function) |
|
| contains ($value) |
|
◆ __construct()
__construct |
( |
Closure |
$finder = null , |
|
|
array |
$options = null , |
|
|
SimpleORMap |
$record = null |
|
) |
| |
Constructor
- Parameters
-
| ?Closure | $finder callable to fill collection |
| ?array | $options relationship options |
SimpleORMap | null | $record | related record |
◆ createFromArray()
static createFromArray |
( |
array |
$data, |
|
|
|
$strict = true |
|
) |
| |
|
static |
creates a collection from an array of objects all objects should be of the same type
- Exceptions
-
InvalidArgumentException | if first entry is not SimpleOrMap |
- Parameters
-
| T[] | $data array with SimpleORMap objects |
bool | $strict | check every element for correct type and unique pk |
- Returns
- SimpleORMapCollection<T>
◆ find()
returns element with given primary key value
- Parameters
-
string | $value | primary key value to search for |
- Returns
- ?T
◆ getClassName()
gets the allowed classname
- Returns
- string
◆ merge()
merge in another collection, elements must be of the same type, if an element already exists it is replaced or ignored depending on second param
- Parameters
-
- Returns
- void
- Exceptions
-
- See also
- SimpleORMapCollection::offsetSet()
◆ offsetSet()
offsetSet |
( |
|
$index, |
|
|
|
$newval |
|
) |
| |
Sets the value at the specified index checks if the value is an object of specified class
- See also
- ArrayObject::offsetSet()
- Exceptions
-
InvalidArgumentException | if the given model does not fit (wrong type or id) |
◆ refresh()
reloads the elements of the collection by calling the finder function
- Exceptions
-
- Returns
- ?int number of records after refresh
◆ setClassName()
setClassName |
( |
|
$class_name | ) |
|
sets the allowed class name
- Parameters
-
- Returns
- void
◆ setRelatedRecord()
sets the related record
- Parameters
-
- Returns
- void
◆ toGroupedArray()
toGroupedArray |
( |
|
$group_by = 'id' , |
|
|
|
$only_these_fields = null , |
|
|
callable |
$group_func = null |
|
) |
| |
returns the collection as grouped array first param is the column to group by, it becomes the key in the resulting array, default is pk. Limit returned fields with second param The grouped entries can optoionally go through the given callback. If no callback is provided, only the first grouped entry is returned, suitable for grouping by unique column
- Parameters
-
string | $group_by | the column to group by, pk if ommitted |
mixed | $only_these_fields | limit returned fields |
| ?callable | $group_func closure to aggregate grouped entries |
- Returns
- array assoc array
◆ unsetByPk()
mark element(s) for deletion element(s) with given primary key are moved to internal deleted collection
- Parameters
-
string | $id | primary key of element |
- Returns
- int number of unsetted elements
◆ $related_record
◆ $relation_options
◆ OBJECT_EXISTS
◆ WRONG_OBJECT_TYPE
const WRONG_OBJECT_TYPE = 1 |
The documentation for this class was generated from the following file: