class PersistentCollection implements PersistentCollectionInterface (View source)

A PersistentCollection represents a collection of elements that have persistent state.

Traits

Trait with methods needed to implement PersistentCollectionInterface.

Methods

setMongoData(array $mongoData)

{@inheritdoc}

getMongoData()

{@inheritdoc}

setHints(array $hints)

{@inheritdoc}

getHints()

{@inheritdoc}

initialize()

{@inheritdoc}

isDirty()

{@inheritdoc}

setDirty($dirty)

{@inheritdoc}

setOwner($document, array $mapping)

{@inheritdoc}

takeSnapshot()

{@inheritdoc}

getSnapshot()

{@inheritdoc}

getOwner()

{@inheritdoc}

getMapping()

{@inheritdoc}

getTypeClass()

{@inheritdoc}

setInitialized($bool)

{@inheritdoc}

first()

{@inheritdoc}

last()

{@inheritdoc}

remove($key)

{@inheritdoc}

removeElement($element)

{@inheritdoc}

containsKey($key)

{@inheritdoc}

contains($element)

{@inheritdoc}

exists(Closure $p)

{@inheritdoc}

indexOf($element)

{@inheritdoc}

get($key)

{@inheritdoc}

getKeys()

{@inheritdoc}

getValues()

{@inheritdoc}

count()

{@inheritdoc}

set($key, $value)

{@inheritdoc}

add($value)

{@inheritdoc}

isEmpty()

{@inheritdoc}

getIterator()

{@inheritdoc}

map(Closure $func)

{@inheritdoc}

filter(Closure $p)

{@inheritdoc}

forAll(Closure $p)

{@inheritdoc}

partition(Closure $p)

{@inheritdoc}

toArray()

{@inheritdoc}

clear()

{@inheritdoc}

slice($offset, $length = null)

{@inheritdoc}

__sleep()

Called by PHP when this collection is serialized. Ensures that only the elements are properly serialized.

offsetExists($offset)

No description

offsetGet($offset)

No description

offsetSet($offset, $value)

No description

offsetUnset($offset)

No description

key()

No description

current()

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

next()

Moves the internal iterator position to the next element.

unwrap()

{@inheritdoc}

__clone()

Cleanup internal state of cloned persistent collection.

__construct(Collection $coll, DocumentManager $dm, UnitOfWork $uow)

No description

Details

setDocumentManager(DocumentManager $dm)

{@inheritdoc}

Parameters

DocumentManager $dm

setMongoData(array $mongoData)

{@inheritdoc}

Parameters

array $mongoData

getMongoData()

{@inheritdoc}

setHints(array $hints)

{@inheritdoc}

Parameters

array $hints

getHints()

{@inheritdoc}

initialize()

{@inheritdoc}

isDirty()

{@inheritdoc}

setDirty($dirty)

{@inheritdoc}

Parameters

$dirty

setOwner($document, array $mapping)

{@inheritdoc}

Parameters

$document
array $mapping

takeSnapshot()

{@inheritdoc}

clearSnapshot()

{@inheritdoc}

getSnapshot()

{@inheritdoc}

getDeleteDiff()

{@inheritdoc}

getDeletedDocuments()

{@inheritdoc}

getInsertDiff()

{@inheritdoc}

getInsertedDocuments()

{@inheritdoc}

getOwner()

{@inheritdoc}

getMapping()

{@inheritdoc}

getTypeClass()

{@inheritdoc}

setInitialized($bool)

{@inheritdoc}

Parameters

$bool

isInitialized()

{@inheritdoc}

first()

{@inheritdoc}

last()

{@inheritdoc}

remove($key)

{@inheritdoc}

Parameters

$key

removeElement($element)

{@inheritdoc}

Parameters

$element

containsKey($key)

{@inheritdoc}

Parameters

$key

contains($element)

{@inheritdoc}

Parameters

$element

exists(Closure $p)

{@inheritdoc}

Parameters

Closure $p

indexOf($element)

{@inheritdoc}

Parameters

$element

get($key)

{@inheritdoc}

Parameters

$key

getKeys()

{@inheritdoc}

getValues()

{@inheritdoc}

count()

{@inheritdoc}

set($key, $value)

{@inheritdoc}

Parameters

$key
$value

add($value)

{@inheritdoc}

Parameters

$value

isEmpty()

{@inheritdoc}

getIterator()

{@inheritdoc}

map(Closure $func)

{@inheritdoc}

Parameters

Closure $func

filter(Closure $p)

{@inheritdoc}

Parameters

Closure $p

forAll(Closure $p)

{@inheritdoc}

Parameters

Closure $p

partition(Closure $p)

{@inheritdoc}

Parameters

Closure $p

toArray()

{@inheritdoc}

clear()

{@inheritdoc}

slice($offset, $length = null)

{@inheritdoc}

Parameters

$offset
$length

__sleep()

Called by PHP when this collection is serialized. Ensures that only the elements are properly serialized.

offsetExists($offset)

Parameters

$offset

See also

containsKey()

offsetGet($offset)

Parameters

$offset

See also

get()

offsetSet($offset, $value)

Parameters

$offset
$value

See also

add()
set()

offsetUnset($offset)

Parameters

$offset

See also

remove()

current()

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

next()

Moves the internal iterator position to the next element.

unwrap()

{@inheritdoc}

__clone()

Cleanup internal state of cloned persistent collection.

The following problems have to be prevented: 1. Added documents are added to old PersistentCollection 2. New collection is not dirty, if reused on other document nothing changes. 3. Snapshot leads to invalid diffs being generated. 4. Lazy loading grabs entities from old owner object. 5. New collection is connected to old owner and leads to duplicate keys.

__construct(Collection $coll, DocumentManager $dm, UnitOfWork $uow)

Parameters

Collection $coll
DocumentManager $dm
UnitOfWork $uow