Class: Doctrine_Collection
Source Location: /Doctrine/Collection.phpClass Doctrine_Collection
Implements interfaces:
Doctrine_Collection Collection of Doctrine_Record objects. Located in /Doctrine/Collection.php [line 34] Doctrine_Object | --Doctrine_Access | --Doctrine_CollectionAuthor(s):
|
|
Child Class | Description |
---|---|
Doctrine_Collection_Offset | Doctrine_Collection_Offset Collection of Doctrine_Record objects. |
Inherited Properties | Inherited Methods | Inherited Constants |
---|---|---|
Inherited From Doctrine_Object |
Inherited From Doctrine_Access
Inherited From Doctrine_Object
|
static Doctrine_Null | $null | |
array | $data | |
string | $keyColumn | |
string | $referenceField | |
array | $_snapshot |
static void | initNullObject() | initNullObject initializes the null object for this collection |
Doctrine_Collection | __construct() | constructor |
boolean | add() | adds a record to collection |
boolean | contains() | contains whether or not this collection contains a specified element |
integer | count() | count this class implements interface countable returns the number of records in this collection |
Doctrine_Collection | delete() | delete |
Doctrine_Record | get() | get returns a record for given key |
array | getData() | getData returns all the records as an array |
void | getDeleteDiff() | |
mixed | getFirst() | getFirst returns the first record in the collection |
void | getInsertDiff() | |
object ArrayIterator | getIterator() | getIterator |
string | getKeyColumn() | getKeyColumn returns the name of the key column |
array | getKeys() | returns all keys |
mixed | getLast() | getLast returns the last record in the collection |
Doctrine_Iterator_Normal | getNormalIterator() | getNormalIterator returns normal iterator - an iterator that will not expand this collection |
array | getPrimaryKeys() | |
mixed | getReference() | getReference |
array | getSnapshot() | getSnapshot returns the data of the last snapshot |
Doctrine_Table | getTable() | getTable returns the table this collection belongs to |
boolean | loadRelated() | loadRelated |
void | populateRelated() | populateRelated |
Doctrine_Collection | processDiff() | processDiff processes the difference of the last snapshot and the current data |
boolean | remove() | remove removes a specified collection element |
Doctrine_Collection | save() | save saves all records of this collection and processes the difference of the last snapshot and the current data |
void | search() | |
array | serialize() | this method is automatically called when this Doctrine_Collection is serialized |
void | set() | set |
Doctrine_Collection | setData() | setData |
Doctrine_Collection | setKeyColumn() | setKeyColumn sets the key column for this collection |
void | setReference() | setReference sets a reference pointer |
Doctrine_Collection | takeSnapshot() | takeSnapshot takes a snapshot from this collection |
void | toArray() | toArray Mimics the result of a $query->execute(array(), Doctrine::FETCH_ARRAY); |
void | unserialize() | unseralize this method is automatically called everytime a Doctrine_Collection object is unserialized |
void | __toString() | returns a string representation of this object |
|
initNullObject initializes the null object for this collection
Parameters:Doctrine_Null | $null: |
API Tags:
Access: | public |
- Doctrine_Object::initNullObject()
- initNullObject initializes the null object
|
constructor
Parameters:Doctrine_Table|string | $table: |
API Tags:
Access: | public |
|
adds a record to collection
Parameters:Doctrine_Record | $record: | record to be added |
string | $key: | optional key for the record |
API Tags:
Access: | public |
|
contains whether or not this collection contains a specified element
Parameters:mixed | $key: | the key of the element |
API Tags:
Access: | public |
|
count this class implements interface countable returns the number of records in this collection
API Tags:
Access: | public |
- Countable::count
|
delete
single shot delete deletes all records from this collection and uses only one database query to perform this operation
Parameters:Doctrine_Connection | $conn: |
API Tags:
Access: | public |
|
get returns a record for given key
There are two special cases:
- if null is given as a key a new record is created and attached
2. if given key does not exist, then a new record is create and attached to the given key
Collection also maps referential information to newly created records
Parameters:mixed | $key: | the key of the element |
API Tags:
Return: | return a specified record |
Access: | public |
|
getData returns all the records as an array
API Tags:
Access: | public |
|
getFirst returns the first record in the collection
API Tags:
Access: | public |
|
getIterator
API Tags:
Access: | public |
- IteratorAggregate::getIterator
|
getKeyColumn returns the name of the key column
API Tags:
Access: | public |
|
getLast returns the last record in the collection
API Tags:
Access: | public |
|
getNormalIterator returns normal iterator - an iterator that will not expand this collection
API Tags:
Access: | public |
|
API Tags:
Return: | an array containing all primary keys |
Access: | public |
|
getSnapshot returns the data of the last snapshot
API Tags:
Return: | returns the data in last snapshot |
Access: | public |
|
getTable returns the table this collection belongs to
API Tags:
Access: | public |
|
loadRelated
Parameters:mixed | $name: |
API Tags:
Access: | public |
|
populateRelated
Parameters:string | $name: | |
Doctrine_Collection | $coll: |
API Tags:
Access: | public |
|
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 object 4
API Tags:
Access: | public |
|
remove removes a specified collection element
Parameters:mixed | $key: |
API Tags:
Access: | public |
|
save saves all records of this collection and processes the difference of the last snapshot and the current data
Parameters:Doctrine_Connection | $conn: | optional connection parameter |
API Tags:
Access: | public |
|
Doctrine_Record | $record: |
API Tags:
Access: | public |
|
this method is automatically called when this Doctrine_Collection is serialized
API Tags:
Access: | public |
- Serializable::serialize
|
set
Parameters:integer | $key: | |
Doctrine_Record | $record: |
API Tags:
Access: | public |
|
setData
Parameters:array | $data: |
API Tags:
Access: | public |
|
setKeyColumn sets the key column for this collection
Parameters:string | $column: |
API Tags:
Access: | public |
|
setReference sets a reference pointer
Parameters:Doctrine_Record | $record: | |
Doctrine_Relation | $relation: |
API Tags:
Access: | public |
|
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.
API Tags:
Access: | public |
|
toArray Mimics the result of a $query->execute(array(), Doctrine::FETCH_ARRAY);
Parameters:boolean | $deep: |
API Tags:
Access: | public |
|
unseralize this method is automatically called everytime a Doctrine_Collection object is unserialized
Parameters:$serialized: |
API Tags:
Access: | public |
- Serializable::unserialize