Pt_BR En Ja De Fr 
You are currently viewing the Development branch api documentation. Switch to 0.11 or 1.0

Development Doctrine_Collection

Doctrine Collection

A persistent collection of entities.

A collection object is strongly typed in the sense that it can only contain entities of a specific type or one it's subtypes.

Inheritence

Doctrine_Collection  < Doctrine_Access

Direct Sub-Classes

Method Details

  • populateRelated($name, ( ) $coll)

    INTERNAL: populateRelated


  • (mixed) key()

    returns the current key


  • $key optional key for the record
    $record record to be added

    (boolean) add($value, $key = null, (Doctrine_Entity) $record)

    adds a record to collection


  • clear()


  • delete($clearColl = false)

    Deletes all records from the collection.


  • getRelation()

    returns the relation object


  • (Doctrine_Iterator_Normal) getNormalIterator()

    getNormalIterator returns normal iterator - an iterator that will not expand this collection


  • importFrom($type, $data)

    Import data to a Doctrine_Collection from one of the supported Doctrine_Parser formats


  • (array) serialize()

    Serializes the collection.

    This method is automatically called when this Doctrine_Collection is serialized.
    Part of the implementation of the Serializable interface.


  • (boolean) loadRelated($name = null)

    INTERNAL: loadRelated


  • __toString()

    returns a string representation of this object


  • $key the key of the element

    (boolean) contains($key)

    Checks whether the collection contains an entity.


  • $key the key of the element

    get($key)

    returns a record for given key

    Collection also maps referential information to newly created records

    Doctrine_Collection


  • $conn optional connection parameter

    save((Doctrine_Connection) $conn)

    Saves all records of this collection and processes the difference of the last snapshot and the current data.


  • (array) getSnapshot()

    getSnapshot returns the data of the last snapshot

    Doctrine_Collection


  • processDiff()

    processDiff processes the difference of the last snapshot and the current data

    an example: Snapshot with the objects 1, 2 and 4 Current data with objects 2, 3 and 5
    The process would remove objects 1 and 4


  • setData($data)


  • takeSnapshot()

    takeSnapshot takes a snapshot from this collection

    snapshots are used for diff processing, for example when a fetched collection has three elements, then two of those are being removed the diff would contain one element
    Doctrine_Collection::save() attaches the diff with the help of last snapshot.


  • (string) getKeyField()

    getKeyField returns the name of the key column


  • (mixed) getReference()

    INTERNAL: getReference


  • (mixed) getLast()

    getLast returns the last record in the collection


  • setKeyField($fieldName, $column)

    setKeyField sets the key column for this collection


  • isEmpty()


  • $mapper The mapper used by the collection.
    $keyColumn The field name that will be used as the key in the collection.

    __construct($entityBaseType, $keyField = null, (Doctrine_Mapper|string) $mapper, $keyColumn)

    Constructor.


  • setReference(( ) $entity, ( ) $relation)

    INTERNAL: sets a reference pointer


  • search(( ) $record)


  • getDeleteDiff()


  • (integer) count()

    Returns the number of records in this collection.

    Implementation of the Countable interface.

    Doctrine_Collection


  • $array representation of a Doctrine_Collection

    synchronizeFromArray($array)

    synchronizeFromArray synchronizes a Doctrine_Collection with data from an array

    it expects an array representation of a Doctrine_Collection similar to the return value of the toArray() method. It will create Dectrine_Records that don't exist on the collection, update the ones that do and remove the ones missing in the $array


  • (mixed) getFirst()

    getFirst returns the first record in the collection


  • (mixed) end()

    returns the last record in the collection


  • (object ArrayIterator) getIterator()


  • set($key, $value, (Doctrine_Entity) $record)


  • (array) getData()

    getData returns all the records as an array


  • free($deep = false)


  • _compareRecords($a, $b)

    _compareRecords Compares two records. To be used on _snapshot diffs using array_udiff.


  • (boolean) remove($key)

    Removes an entity from the collection.


  • exportTo($type, $deep = false)

    Export a Doctrine_Collection to one of the supported Doctrine_Parser formats


  • (array) getPrimaryKeys()

    Returns the primary keys of all records in the collection.

    Doctrine_Collection


  • fromArray($array, $deep = true)

    Populate a Doctrine_Collection from an array of data


  • toArray($deep = false, $prefixKey = false)

    toArray Mimics the result of a $query->execute(array(), Doctrine::FETCH_ARRAY);


  • $serialized The serialized data

    unserialize($serialized)

    Reconstitutes the collection object from it's serialized form.

    This method is automatically called everytime a Doctrine_Collection object is unserialized.
    Part of the implementation of the Serializable interface.


  • (array) getKeys()

    returns all keys


  • getInsertDiff()


Comments (0) [ add comment ]

 No Comments

Add Comment

Add New Comment
Please enter follow the doctrine