class ResultSet extends ResultSet

ORM result set.

Traits

Extendable trait.

Properties

static protected array $_extensions Class extensions. from ExtendableTrait
protected array $items Collection items. from Collection
protected PaginationInterface $pagination Pagination. from ResultSet

Methods

static 
extend(string $methodName, Closure $closure)

Extends the class.

mixed
__call(string $name, array $arguments)

Executes class extensions.

static mixed
__callStatic(string $name, array $arguments)

Executes class extensions.

__construct(array $items = [])

Constructor.

array
getItems()

Returns all the items in the collection.

array
getValues()

Returns all the values in the collection.

resetKeys()

Resets the collection keys.

put(int|string $key, mixed $value)

Adds a new item to the collection.

bool
has(int|string $key)

Returns TRUE if the item key exists and FALSE if not.

mixed
get(int|string $key, mixed $default = null)

Returns an item from the collection.

remove(int|string $key)

Removes an item from the collection.

clear()

Clears the collection.

bool
offsetExists(mixed $offset)

Checks whether or not an offset exists.

mixed
offsetGet(mixed $offset)

Returns the value at the specified offset.

offsetSet(mixed $offset, mixed $value)

Assigns a value to the specified offset.

offsetUnset(mixed $offset)

Unsets an offset.

int
count()

Returns the numner of items in the collection.

getIterator()

Retruns an array iterator object.

bool
isEmpty()

Returns TRUE if the collection is empty and FALSE if not.

int
unshift(mixed $item)

Prepends the passed item to the front of the collection and returns the new number of elements in the collection.

mixed
shift()

Shifts the first value of the collection off and returns it, shortening the collection by one element.

int
push(mixed $item)

Pushes the passed variable onto the end of the collection and returns the new number of elements in the collection.

mixed
pop()

Pops and returns the last value of the collection, shortening the collection by one element.

bool
sort(callable $comparator, bool $maintainIndexAssociation = true)

Sorts the collection using the specified comparator callable and returns TRUE on success and FALSE on failure.

chunk(int $size)

Chunks the collection into a collection containing $size sized collections.

bool
shuffle()

Shuffles the items in the collection and returns TRUE on success and FALSE on failure.

each(callable $callable)

Applies the callable on all items in the collection.

map(callable $callable)

Returns a new collection where the callable has been applied to all the items.

filter(callable $callable = null)

Returns a new filtered collection.

merge(Collection $collection)

Merges two collections.

setPagination(PaginationInterface $pagination)

Sets the pagination.

from ResultSet
getPagination()

Returns the pagination.

from ResultSet
array
pluck(string $column)

Returns an array containing only the values of chosen column.

from ResultSet
array
toArray()

Returns an array representation of the result set.

from ResultSet
array
jsonSerialize()

Returns data which can be serialized by json_encode().

from ResultSet
string
toJson(int $options = 0)

Returns a json representation of the result set.

from ResultSet
string
__toString()

Returns a json representation of the result set.

from ResultSet
__clone()

Clones all items when cloning the collection.

protect(string|array|bool $column)

Excludes the chosen columns and relations from array and json representations of the collection.

expose(string|array|bool $column)

Exposes the chosen columns and relations in the array and json representations of the collection.

include(string|array $includes)

Eager loads relations on the collection.

Details

in ExtendableTrait at line 35
static extend(string $methodName, Closure $closure)

Extends the class.

Parameters

string $methodName Method name
Closure $closure Closure

in ExtendableTrait at line 47
mixed __call(string $name, array $arguments)

Executes class extensions.

Parameters

string $name Method name
array $arguments Method arguments

Return Value

mixed

in ExtendableTrait at line 64
static mixed __callStatic(string $name, array $arguments)

Executes class extensions.

Parameters

string $name Method name
array $arguments Method arguments

Return Value

mixed

in Collection at line 56
__construct(array $items = [])

Constructor.

Parameters

array $items Collection items

in Collection at line 66
array getItems()

Returns all the items in the collection.

Return Value

array

in Collection at line 76
array getValues()

Returns all the values in the collection.

Return Value

array

in Collection at line 84
resetKeys()

Resets the collection keys.

in Collection at line 95
put(int|string $key, mixed $value)

Adds a new item to the collection.

Parameters

int|string $key Key
mixed $value Value

in Collection at line 106
bool has(int|string $key)

Returns TRUE if the item key exists and FALSE if not.

Parameters

int|string $key Key

Return Value

bool

in Collection at line 118
mixed get(int|string $key, mixed $default = null)

Returns an item from the collection.

Parameters

int|string $key Key
mixed $default Default value

Return Value

mixed

in Collection at line 133
remove(int|string $key)

Removes an item from the collection.

Parameters

int|string $key Key

in Collection at line 141
clear()

Clears the collection.

in Collection at line 152
bool offsetExists(mixed $offset)

Checks whether or not an offset exists.

Parameters

mixed $offset The offset to check for

Return Value

bool

in Collection at line 163
mixed offsetGet(mixed $offset)

Returns the value at the specified offset.

Parameters

mixed $offset The offset to retrieve

Return Value

mixed

in Collection at line 179
offsetSet(mixed $offset, mixed $value)

Assigns a value to the specified offset.

Parameters

mixed $offset The offset to assign the value to
mixed $value The value to set

in Collection at line 196
offsetUnset(mixed $offset)

Unsets an offset.

Parameters

mixed $offset The offset to unset

in Collection at line 206
int count()

Returns the numner of items in the collection.

Return Value

int

in Collection at line 216
ArrayIterator getIterator()

Retruns an array iterator object.

Return Value

ArrayIterator

in Collection at line 226
bool isEmpty()

Returns TRUE if the collection is empty and FALSE if not.

Return Value

bool

in Collection at line 238
int unshift(mixed $item)

Prepends the passed item to the front of the collection and returns the new number of elements in the collection.

Parameters

mixed $item Collection item

Return Value

int

in Collection at line 249
mixed shift()

Shifts the first value of the collection off and returns it, shortening the collection by one element.

Return Value

mixed

in Collection at line 261
int push(mixed $item)

Pushes the passed variable onto the end of the collection and returns the new number of elements in the collection.

Parameters

mixed $item Collection item

Return Value

int

in Collection at line 272
mixed pop()

Pops and returns the last value of the collection, shortening the collection by one element.

Return Value

mixed

in Collection at line 285
bool sort(callable $comparator, bool $maintainIndexAssociation = true)

Sorts the collection using the specified comparator callable and returns TRUE on success and FALSE on failure.

Parameters

callable $comparator Comparator callable
bool $maintainIndexAssociation Maintain index association?

Return Value

bool

in Collection at line 296
Collection chunk(int $size)

Chunks the collection into a collection containing $size sized collections.

Parameters

int $size Chunk size

Return Value

Collection

in Collection at line 314
bool shuffle()

Shuffles the items in the collection and returns TRUE on success and FALSE on failure.

Return Value

bool

in Collection at line 324
each(callable $callable)

Applies the callable on all items in the collection.

Parameters

callable $callable Callable

in Collection at line 339
Collection map(callable $callable)

Returns a new collection where the callable has been applied to all the items.

Parameters

callable $callable Callable

Return Value

Collection

in Collection at line 354
Collection filter(callable $callable = null)

Returns a new filtered collection.

Parameters

callable $callable Filter

Return Value

Collection

in Collection at line 370
Collection merge(Collection $collection)

Merges two collections.

Parameters

Collection $collection Collection to merge

Return Value

Collection

in ResultSet at line 36
setPagination(PaginationInterface $pagination)

Sets the pagination.

Parameters

PaginationInterface $pagination Pagination

in ResultSet at line 46
PaginationInterface getPagination()

Returns the pagination.

Return Value

PaginationInterface

in ResultSet at line 57
array pluck(string $column)

Returns an array containing only the values of chosen column.

Parameters

string $column Column name

Return Value

array

in ResultSet at line 67
array toArray()

Returns an array representation of the result set.

Return Value

array

in ResultSet at line 84
array jsonSerialize()

Returns data which can be serialized by json_encode().

Return Value

array

in ResultSet at line 100
string toJson(int $options = 0)

Returns a json representation of the result set.

Parameters

int $options JSON encode options

Return Value

string

in ResultSet at line 110
string __toString()

Returns a json representation of the result set.

Return Value

string

at line 22
__clone()

Clones all items when cloning the collection.

at line 35
protect(string|array|bool $column)

Excludes the chosen columns and relations from array and json representations of the collection.

Parameters

string|array|bool $column Column or relation to hide from the

at line 48
expose(string|array|bool $column)

Exposes the chosen columns and relations in the array and json representations of the collection.

Parameters

string|array|bool $column Column or relation to hide from the

at line 62
ResultSet include(string|array $includes)

Eager loads relations on the collection.

Parameters

string|array $includes Relation or array of relations to eager load

Return Value

ResultSet