class PersistentRelatedEntitiesCollection implements Collection, Selectable

Collection for persistent related entities.

We do not support all of Doctrine's built-in features.

Methods

__construct(Registry $registry, Job $job)

No description

array
toArray()

Gets the PHP array representation of this collection.

object|false
first()

Sets the internal iterator to the first element in the collection and returns this element.

object|false
last()

Sets the internal iterator to the last element in the collection and returns this element.

string|integer
key()

Gets the current key/index at the current internal iterator position.

object|false
next()

Moves the internal iterator position to the next element.

object|false
current()

Gets the element of the collection at the current internal iterator position.

object|null
remove(string|integer $key)

Removes an element with a specific key/index from the collection.

boolean
removeElement(object $element)

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

bool
offsetExists(mixed $offset)

ArrayAccess implementation of offsetExists()

mixed
offsetGet(mixed $offset)

ArrayAccess implementation of offsetGet()

bool
offsetSet(mixed $offset, mixed $value)

ArrayAccess implementation of offsetSet()

mixed
offsetUnset(mixed $offset)

ArrayAccess implementation of offsetUnset()

boolean
containsKey(mixed $key)

Checks whether the collection contains a specific key/index.

boolean
contains(mixed $element)

Checks whether the given element is contained in the collection.

boolean
exists(Closure $p)

Tests for the existence of an element that satisfies the given predicate.

mixed
indexOf(mixed $element)

Searches for a given element and, if found, returns the corresponding key/index of that element. The comparison of two elements is strict, that means not only the value but also the type must match.

mixed
get(mixed $key)

Gets the element with the given key/index.

array
getKeys()

Gets all keys/indexes of the collection elements.

array
getValues()

Gets all elements.

integer
count()

Returns the number of elements in the collection.

set(mixed $key, mixed $value)

Adds/sets an element in the collection at the index / with the specified key.

boolean
add(mixed $value)

Adds an element to the collection.

boolean
isEmpty()

Checks whether the collection is empty.

getIterator()

Gets an iterator for iterating over the elements in the collection.

Collection
map(Closure $func)

Applies the given function to each element in the collection and returns a new collection with the elements returned by the function.

Collection
filter(Closure $p)

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

boolean
forAll(Closure $p)

Applies the given predicate p to all elements of this collection, returning true, if the predicate yields true for all elements.

array
partition(Closure $p)

Partitions this collection in two collections according to a predicate.

string
__toString()

Returns a string representation of this object.

clear()

Clears the collection.

array
slice(int $offset, int $length = null)

Extract a slice of $length elements starting at position $offset from the Collection.

Collection
matching(Criteria $criteria)

Select all elements from a selectable that match the criteria and return a new collection containing these elements.

Details

at line 28
__construct(Registry $registry, Job $job)

Parameters

Registry $registry
Job $job

at line 39
array toArray()

Gets the PHP array representation of this collection.

Return Value

array The PHP array representation of this collection.

at line 52
object|false first()

Sets the internal iterator to the first element in the collection and returns this element.

Return Value

object|false

at line 65
object|false last()

Sets the internal iterator to the last element in the collection and returns this element.

Return Value

object|false

at line 77
string|integer key()

Gets the current key/index at the current internal iterator position.

Return Value

string|integer

at line 89
object|false next()

Moves the internal iterator position to the next element.

Return Value

object|false

at line 101
object|false current()

Gets the element of the collection at the current internal iterator position.

Return Value

object|false

at line 114
object|null remove(string|integer $key)

Removes an element with a specific key/index from the collection.

Parameters

string|integer $key

Return Value

object|null The removed element or NULL, if no element exists for the given key.

at line 125
boolean removeElement(object $element)

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

Parameters

object $element The element to remove.

Return Value

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

at line 138
bool offsetExists(mixed $offset)

ArrayAccess implementation of offsetExists()

Parameters

mixed $offset

Return Value

bool

See also

containsKey()

at line 153
mixed offsetGet(mixed $offset)

ArrayAccess implementation of offsetGet()

Parameters

mixed $offset

Return Value

mixed

See also

get()

at line 170
bool offsetSet(mixed $offset, mixed $value)

ArrayAccess implementation of offsetSet()

Parameters

mixed $offset
mixed $value

Return Value

bool

See also

add()
set()

at line 183
mixed offsetUnset(mixed $offset)

ArrayAccess implementation of offsetUnset()

Parameters

mixed $offset

Return Value

mixed

See also

remove()

at line 194
boolean containsKey(mixed $key)

Checks whether the collection contains a specific key/index.

Parameters

mixed $key The key to check for.

Return Value

boolean TRUE if the given key/index exists, FALSE otherwise.

at line 211
boolean contains(mixed $element)

Checks whether the given element is contained in the collection.

Only element values are compared, not keys. The comparison of two elements is strict, that means not only the value but also the type must match. For objects this means reference equality.

Parameters

mixed $element

Return Value

boolean TRUE if the given element is contained in the collection, FALSE otherwise.

at line 230
boolean exists(Closure $p)

Tests for the existence of an element that satisfies the given predicate.

Parameters

Closure $p The predicate.

Return Value

boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise.

at line 251
mixed indexOf(mixed $element)

Searches for a given element and, if found, returns the corresponding key/index of that element. The comparison of two elements is strict, that means not only the value but also the type must match.

For objects this means reference equality.

Parameters

mixed $element The element to search for.

Return Value

mixed The key/index of the element or FALSE if the element was not found.

at line 264
mixed get(mixed $key)

Gets the element with the given key/index.

Parameters

mixed $key The key.

Return Value

mixed The element or NULL, if no element exists for the given key.

at line 279
array getKeys()

Gets all keys/indexes of the collection elements.

Return Value

array

at line 291
array getValues()

Gets all elements.

Return Value

array

at line 305
integer count()

Returns the number of elements in the collection.

Implementation of the Countable interface.

Return Value

integer The number of elements in the collection.

at line 321
set(mixed $key, mixed $value)

Adds/sets an element in the collection at the index / with the specified key.

When the collection is a Map this is like put(key,value)/add(key,value). When the collection is a List this is like add(position,value).

Parameters

mixed $key
mixed $value

at line 332
boolean add(mixed $value)

Adds an element to the collection.

Parameters

mixed $value

Return Value

boolean Always TRUE.

at line 344
boolean isEmpty()

Checks whether the collection is empty.

Note: This is preferable over count() == 0.

Return Value

boolean TRUE if the collection is empty, FALSE otherwise.

at line 356
ArrayIterator getIterator()

Gets an iterator for iterating over the elements in the collection.

Return Value

ArrayIterator

at line 370
Collection map(Closure $func)

Applies the given function to each element in the collection and returns a new collection with the elements returned by the function.

Parameters

Closure $func

Return Value

Collection

at line 384
Collection filter(Closure $p)

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

The order of the elements is preserved.

Parameters

Closure $p The predicate used for filtering.

Return Value

Collection A collection with the results of the filter operation.

at line 398
boolean forAll(Closure $p)

Applies the given predicate p to all elements of this collection, returning true, if the predicate yields true for all elements.

Parameters

Closure $p The predicate.

Return Value

boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.

at line 420
array partition(Closure $p)

Partitions this collection in two collections according to a predicate.

Keys are preserved in the resulting collections.

Parameters

Closure $p The predicate on which to partition.

Return Value

array 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.

at line 440
string __toString()

Returns a string representation of this object.

Return Value

string

at line 448
clear()

Clears the collection.

at line 464
array slice(int $offset, int $length = null)

Extract a slice of $length elements starting at position $offset from the Collection.

If $length is null it returns all elements from $offset to the end of the Collection. Keys have to be preserved by this method. Calling this method will only return the selected slice and NOT change the elements contained in the collection slice is called on.

Parameters

int $offset
int $length

Return Value

array

at line 478
Collection matching(Criteria $criteria)

Select all elements from a selectable that match the criteria and return a new collection containing these elements.

Parameters

Criteria $criteria

Return Value

Collection