Doctrine\ORM\PersistentCollection

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

Collections of entities represent only the associations (links) to those entities.
That means, if the collection is part of a many-many mapping and you remove
entities from the collection, only the links in the relation table are removed (on flush).
Similarly, if you remove entities from a collection that is part of a one-many
mapping this will only result in the nulling out of the foreign keys on flush.

Synopsis

class PersistentCollection implements Collection,Selectable {
}

Hierarchy

Tasks

Line Task
48+ Design for inheritance to allow custom implementations?
382 If the keys are persistent as well (not yet implemented)

Members

private

Methods

private

  • changed() — Marks this collection as changed/dirty.

public

  • __construct() — Creates a new persistent collection.
  • __clone() — Cleanup internal state of cloned persistent collection.
  • __sleep() — Called by PHP when this collection is serialized. Ensures that only the elements are properly serialized.
  • add() — {@inheritdoc}
  • clear() — {@inheritdoc}
  • contains() — {@inheritdoc}
  • containsKey() — {@inheritdoc}
  • count() — {@inheritdoc}
  • current() — Gets the element of the collection at the current iterator position.
  • exists() — {@inheritdoc}
  • filter() — {@inheritdoc}
  • first() — {@inheritdoc}
  • forAll() — {@inheritdoc}
  • get() — {@inheritdoc}
  • getDeleteDiff() — INTERNAL: getDeleteDiff
  • getInsertDiff() — INTERNAL: getInsertDiff
  • getIterator() — {@inheritdoc}
  • getKeys() — {@inheritdoc}
  • getMapping() — INTERNAL: Gets the association mapping of the collection.
  • getOwner() — INTERNAL: Gets the collection owner.
  • getSnapshot() — INTERNAL: Returns the last snapshot of the elements in the collection.
  • getTypeClass()
  • getValues() — {@inheritdoc}
  • hydrateAdd() — INTERNAL: Adds an element to a collection during hydration. This will automatically complete bidirectional associations in the case of a one-to-many association.
  • hydrateSet() — INTERNAL: Sets a keyed element in the collection during hydration.
  • indexOf() — {@inheritdoc}
  • initialize() — Initializes the collection by loading its contents from the database if the collection is not yet initialized.
  • isDirty() — Gets a boolean flag indicating whether this collection is dirty which means its state needs to be synchronized with the database.
  • isEmpty() — {@inheritdoc}
  • isInitialized() — Checks whether this collection has been initialized.
  • key()
  • last() — {@inheritdoc}
  • map() — {@inheritdoc}
  • matching() — Select all elements from a selectable that match the expression and return a new collection containing these elements.
  • offsetExists()
  • offsetGet()
  • offsetSet()
  • offsetUnset()
  • partition() — {@inheritdoc}
  • remove() — {@inheritdoc}
  • removeElement() — {@inheritdoc}
  • set() — {@inheritdoc}
  • setDirty() — Sets a boolean flag, indicating whether this collection is dirty.
  • setInitialized() — Sets the initialized flag of the collection, forcing it into that state.
  • setOwner() — INTERNAL: Sets the collection's owning entity together with the AssociationMapping that describes the association between the owner and the elements of the collection.
  • slice() — Extract a slice of $length elements starting at position $offset from the Collection.
  • takeSnapshot() — INTERNAL: Tells this collection to take a snapshot of its current state.
  • toArray() — {@inheritdoc}
  • unwrap() — Retrieves the wrapped Collection instance.