Method |
Description |
|
__call ( $name, $args ) |
Magic Method, used for scopes |
|
__construct ( $class, $query, $add = false ) |
|
|
__invoke ( $sql, $params = [] ) |
Filter function when called as a function |
|
aggregate ( $function, $fields = null ) |
helpers for common aggregate functions |
|
avg ( $field ) |
|
|
column ( $field ) |
Reduces a collection down to a single column |
|
count ( ) |
Counts the number or results in the query |
|
delete ( ) |
Delete all objects in a collection |
|
filter ( $sql, $params = [] ) |
Adds a filter to the collection |
|
first ( ) |
|
|
getIterator ( ) |
Returns an iterator |
|
groupBy ( $columns ) |
Groups domain objects particular columns, either a single column an array. This
method is additive, it won't replace previous groupBy's |
|
hydrate ( $row ) |
Hydrates a row to a DomainObject |
|
includes ( $rels ) |
Eager load relationships to avoid the N+1 problem |
|
join ( $rels, $joinType = 'inner' ) |
Join other related objects into a collection for the purpose of filtering. Relationships
is either a flat array of relationships (as defined in the object's schema) or a nested array |
|
last ( ) |
|
|
limit ( $rows, $offset ) |
Restricts the number of rows to return |
|
lock ( $clause = null ) |
Adds a locking clause to the query |
|
max ( $field ) |
|
|
min ( $field ) |
|
|
offsetExists ( $offset ) |
|
|
offsetGet ( $offset ) |
array access |
|
offsetSet ( $offset, $value ) |
|
|
offsetUnset ( $offset ) |
|
|
one ( ) |
Return one and one only object from a collection |
|
orCreate ( $args ) |
Creates the passed params as a domain object if there are no
results in the collection. |
|
order ( $sql, $params = [] ) |
Orders the collection |
|
orderBy ( $sql, $params = [] ) |
Orders the collection |
|
query ( ) |
Gets the underlying query object |
|
save ( $callback ) |
Applies a callback to all objects in Collection, saves them if
the object has changed |
|
select ( $fields ) |
Selects only particular fields |
|
sum ( $field ) |
|
|
toArray ( ) |
|
|
unique ( ) |
Return only unique combinations of the domain object in the collection, e.g such
as when you want only the unique objects that are the result of a join on
conditions. Only columns from the primary object will be in the result. |
|