ResultSet
class ResultSet extends ResultSet
ORM result set.
Traits
Properties
static protected array | $_extensions | Class extensions. | from ExtendableTrait |
protected array | $items | Collection items. | from Collection |
protected PaginationInterface | $pagination | Pagination. | from ResultSet |
Methods
Executes class extensions.
Returns an item from the collection.
Prepends the passed item to the front of the collection and returns the new number of elements in the collection.
Shifts the first value of the collection off and returns it, shortening the collection by one element.
Pushes the passed variable onto the end of the collection and returns the new number of elements in the collection.
Pops and returns the last value of the collection, shortening the collection by one element.
Returns the first item of the collection or NULL if the collection is empty.
Returns the last item of the collection or NULL if the collection is empty.
Sorts the collection using the specified comparator callable and returns TRUE on success and FALSE on failure.
Chunks the collection into a collection containing $size sized collections.
Shuffles the items in the collection and returns TRUE on success and FALSE on failure.
Returns a new collection where the callable has been applied to all the items.
Returns a new filtered collection.
Returns a new collection where all items not in the provided list have been removed.
Returns a new collection where all items in the provided list have been removed.
Returns an array containing only the values of chosen column.
Clones all items when cloning the collection.
Excludes the chosen columns and relations from array and json representations of the collection.
Exposes the chosen columns and relations in the array and json representations of the collection.
Eager loads relations on the collection.
Details
in ExtendableTrait at line 33
static
addMethod(string $methodName, Closure $closure)
Adds a method to the class.
in ExtendableTrait at line 45
mixed
__call(string $name, array $arguments)
Executes class extensions.
in ExtendableTrait at line 62
static mixed
__callStatic(string $name, array $arguments)
Executes class extensions.
in Collection at line 59
__construct(array $items = [])
Constructor.
in Collection at line 69
array
getItems()
Returns all the items in the collection.
in Collection at line 79
array
getValues()
Returns all the values in the collection.
in Collection at line 89
$this
resetKeys()
Resets the collection keys.
in Collection at line 103
$this
put(int|string $key, mixed $value)
Adds a new item to the collection.
in Collection at line 116
bool
has(int|string $key)
Returns TRUE if the item key exists and FALSE if not.
in Collection at line 128
mixed
get(int|string $key, mixed $default = null)
Returns an item from the collection.
in Collection at line 144
$this
remove(int|string $key)
Removes an item from the collection.
in Collection at line 156
$this
clear()
Clears the collection.
in Collection at line 169
bool
offsetExists(mixed $offset)
Checks whether or not an offset exists.
in Collection at line 180
mixed
offsetGet(mixed $offset)
Returns the value at the specified offset.
in Collection at line 196
offsetSet(mixed $offset, mixed $value)
Assigns a value to the specified offset.
in Collection at line 213
offsetUnset(mixed $offset)
Unsets an offset.
in Collection at line 223
int
count()
Returns the numner of items in the collection.
in Collection at line 233
ArrayIterator
getIterator()
Retruns an array iterator object.
in Collection at line 243
bool
isEmpty()
Returns TRUE if the collection is empty and FALSE if not.
in Collection at line 255
int
unshift(mixed $item)
Prepends the passed item to the front of the collection and returns the new number of elements in the collection.
in Collection at line 266
mixed
shift()
Shifts the first value of the collection off and returns it, shortening the collection by one element.
in Collection at line 278
int
push(mixed $item)
Pushes the passed variable onto the end of the collection and returns the new number of elements in the collection.
in Collection at line 289
mixed
pop()
Pops and returns the last value of the collection, shortening the collection by one element.
in Collection at line 299
mixed
first()
Returns the first item of the collection or NULL if the collection is empty.
in Collection at line 316
mixed
last()
Returns the last item of the collection or NULL if the collection is empty.
in Collection at line 336
$this
sort(callable $comparator, bool $maintainIndexAssociation = true)
Sorts the collection using the specified comparator callable and returns TRUE on success and FALSE on failure.
in Collection at line 356
Collection
chunk(int $size)
Chunks the collection into a collection containing $size sized collections.
in Collection at line 374
$this
shuffle()
Shuffles the items in the collection and returns TRUE on success and FALSE on failure.
in Collection at line 387
$this
each(callable $callable)
Applies the callable on all items in the collection.
in Collection at line 404
Collection
map(callable $callable)
Returns a new collection where the callable has been applied to all the items.
in Collection at line 419
Collection
filter(callable|null $callable = null)
Returns a new filtered collection.
in Collection at line 435
Collection
with(array $keys)
Returns a new collection where all items not in the provided list have been removed.
in Collection at line 446
Collection
without(array $keys)
Returns a new collection where all items in the provided list have been removed.
in Collection at line 457
Collection
merge(Collection $collection)
Merges two collections.
in ResultSet at line 34
setPagination(PaginationInterface $pagination)
Sets the pagination.
in ResultSet at line 44
PaginationInterface
getPagination()
Returns the pagination.
in ResultSet at line 55
array
pluck(string $column)
Returns an array containing only the values of chosen column.
in ResultSet at line 65
array
toArray()
Returns an array representation of the result set.
in ResultSet at line 82
array
jsonSerialize()
Returns data which can be serialized by json_encode().
in ResultSet at line 98
string
toJson(int $options = 0)
Returns a json representation of the result set.
in ResultSet at line 108
string
__toString()
Returns a json representation of the result set.
at line 20
__clone()
Clones all items when cloning the collection.
at line 33
protect(array|false|string $column)
Excludes the chosen columns and relations from array and json representations of the collection.
at line 46
expose(array|string|true $column)
Exposes the chosen columns and relations in the array and json representations of the collection.
at line 60
$this
include(array|string $includes)
Eager loads relations on the collection.