Doctrine\Common\Collections\ArrayCollection

An ArrayCollection is a Collection implementation that wraps a regular PHP array.

Synopsis

class ArrayCollection implements Collection,Selectable {
}

Hierarchy

Members

private

  • $_elements — array
    An array containing the entries of this collection.

Methods

public

  • __construct() — Initializes a new ArrayCollection.
  • __toString() — Returns a string representation of this object.
  • add() — Adds an element to the collection.
  • clear() — Clears the collection.
  • contains() — Checks whether the given element is contained in the collection.
  • containsKey() — Checks whether the collection contains a specific key/index.
  • count() — Returns the number of elements in the collection.
  • current() — Gets the element of the collection at the current internal iterator position.
  • exists() — Tests for the existence of an element that satisfies the given predicate.
  • filter() — Returns all the elements of this collection that satisfy the predicate p.
  • first() — Sets the internal iterator to the first element in the collection and returns this element.
  • forAll() — Applies the given predicate p to all elements of this collection, returning true, if the predicate yields true for all elements.
  • get() — Gets the element with the given key/index.
  • getIterator() — Gets an iterator for iterating over the elements in the collection.
  • getKeys() — Gets all keys/indexes of the collection elements.
  • getValues() — Gets all elements.
  • indexOf() — 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.
  • isEmpty() — Checks whether the collection is empty.
  • key() — Gets the current key/index at the current internal iterator position.
  • last() — Sets the internal iterator to the last element in the collection and returns this element.
  • map() — Applies the given function to each element in the collection and returns a new collection with the elements returned by the function.
  • matching() — Select all elements from a selectable that match the criteria and return a new collection containing these elements.
  • offsetExists() — ArrayAccess implementation of offsetExists()
  • offsetGet() — ArrayAccess implementation of offsetGet()
  • offsetSet() — ArrayAccess implementation of offsetSet()
  • offsetUnset() — ArrayAccess implementation of offsetUnset()
  • partition() — Partitions this collection in two collections according to a predicate.
  • remove() — Removes an element with a specific key/index from the collection.
  • removeElement() — Removes the specified element from the collection, if it is found.
  • set() — Adds/sets an element in the collection at the index / with the specified key.
  • slice() — Extract a slice of $length elements starting at position $offset from the Collection.
  • toArray() — Gets the PHP array representation of this collection.