Documentation

LazyCriteriaCollection extends AbstractLazyCollection
in package
implements Selectable

A lazy collection that allows a fast count when using criteria object Once count gets executed once without collection being initialized, result is cached and returned on subsequent calls until collection gets loaded, then returning the number of loaded results.

Tags
template

TKey of array-key

template

TValue of object

extends

AbstractLazyCollection<TKey, TValue>

implements

Selectable<TKey, TValue>

Table of Contents

Interfaces

Selectable
Interface for collections that allow efficient filtering with an expression API.

Properties

$collection  : Collection<string|int, mixed>|null
The backed collection to use
$criteria  : Criteria
$entityPersister  : EntityPersister
$initialized  : bool
$count  : int|null

Methods

__construct()  : mixed
add()  : true
Adds an element at the end of the collection.
clear()  : void
Clears the collection, removing all elements.
contains()  : mixed
{@inheritDoc}
containsKey()  : mixed
{@inheritDoc}
count()  : int
Do an efficient count on the collection
current()  : mixed
{@inheritDoc}
exists()  : mixed
{@inheritDoc}
filter()  : Collection<string|int, mixed>
Returns all the elements of this collection that satisfy the predicate p.
first()  : mixed
{@inheritDoc}
forAll()  : mixed
{@inheritDoc}
get()  : mixed
{@inheritDoc}
getIterator()  : Traversable<int|string, mixed>
{@inheritDoc}
getKeys()  : mixed
{@inheritDoc}
getValues()  : mixed
{@inheritDoc}
indexOf()  : mixed
{@inheritDoc}
isEmpty()  : bool
check if collection is empty without loading it
isInitialized()  : bool
Is the lazy collection already initialized?
key()  : mixed
{@inheritDoc}
last()  : mixed
{@inheritDoc}
map()  : mixed
{@inheritDoc}
matching()  : Collection<string|int, mixed>|Selectable<string|int, mixed>
Selects all elements from a selectable that match the expression and returns a new collection containing these elements.
next()  : mixed
{@inheritDoc}
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
partition()  : array<string|int, Collection<string|int, mixed>>
Partitions this collection in two collections according to a predicate.
remove()  : mixed
Removes the element at the specified index from the collection.
removeElement()  : bool
Removes the specified element from the collection, if it is found.
set()  : void
Sets an element in the collection at the specified key/index.
slice()  : mixed
{@inheritDoc}
toArray()  : mixed
{@inheritDoc}
doInitialize()  : void
Do the initialization logic
initialize()  : void
Initialize the collection

Properties

Methods

add()

Adds an element at the end of the collection.

public add(mixed $element) : true
Parameters
$element : mixed

The element to add.

Return values
true

Always TRUE.

contains()

{@inheritDoc}

public contains(mixed $element) : mixed

Do an optimized search of an element

Parameters
$element : mixed
Tags
template

TMaybeContained

filter()

Returns all the elements of this collection that satisfy the predicate p.

public filter(Closure $p) : Collection<string|int, mixed>
Parameters
$p : Closure

The predicate used for filtering.

Return values
Collection<string|int, mixed>

A collection with the results of the filter operation.

getIterator()

{@inheritDoc}

public getIterator() : Traversable<int|string, mixed>
Tags
psalm-return

Traversable<TKey,T>

Return values
Traversable<int|string, mixed>

indexOf()

{@inheritDoc}

public indexOf(mixed $element) : mixed
Parameters
$element : mixed
Tags
template

TMaybeContained

isEmpty()

check if collection is empty without loading it

public isEmpty() : bool
Return values
bool

TRUE if the collection is empty, FALSE otherwise.

isInitialized()

Is the lazy collection already initialized?

public isInitialized() : bool
Tags
psalm-assert-if-true

Collection<TKey,T> $this->collection

Return values
bool

offsetExists()

public offsetExists(TKey $offset) : bool
Parameters
$offset : TKey
Return values
bool

offsetSet()

public offsetSet(TKey|null $offset, T $value) : void
Parameters
$offset : TKey|null
$value : T

partition()

Partitions this collection in two collections according to a predicate.

public partition(Closure $p) : array<string|int, Collection<string|int, mixed>>
Parameters
$p : Closure

The predicate on which to partition.

Return values
array<string|int, Collection<string|int, mixed>>

An array with two elements. The first element contains the collection of elements where the predicate returned TRUE, the second element contains the collection of elements where the predicate returned FALSE.

remove()

Removes the element at the specified index from the collection.

public remove(mixed $key) : mixed
Parameters
$key : mixed

The key/index of the element to remove.

Return values
mixed

The removed element or NULL, if the collection did not contain the element.

removeElement()

Removes the specified element from the collection, if it is found.

public removeElement(mixed $element) : bool
Parameters
$element : mixed

The element to remove.

Return values
bool

TRUE if this collection contained the specified element, FALSE otherwise.

set()

Sets an element in the collection at the specified key/index.

public set(mixed $key, mixed $value) : void
Parameters
$key : mixed

The key/index of the element to set.

$value : mixed

The element to set.

slice()

{@inheritDoc}

public slice(mixed $offset[, mixed $length = null ]) : mixed
Parameters
$offset : mixed
$length : mixed = null

initialize()

Initialize the collection

protected initialize() : void
Tags
psalm-assert

Collection<TKey,T> $this->collection


        
On this page

Search results