Commit 80dad424 authored by zYne's avatar zYne

Doctrine_Collection docs updated

parent 69fff9cd
When accessing single elements of the collection and those elements (records) don't exist Doctrine auto-adds them.
<br \><br \>
In the following example
we fetch all users from database (there are 5) and then add couple of users in the collection.
<br \><br \>
As with PHP arrays the indexes start from zero.
......@@ -7,3 +7,7 @@ of users doctrine only performs two queries for this whole transaction. The quer
<br \><br \>
DELETE FROM user WHERE id IN (1,2,3, ... ,N)<br \>
DELETE FROM phonenumber WHERE id IN (1,2,3, ... ,M)<br \>
<br \><br \>
It should also be noted that Doctrine is smart enough to perform single-shot-delete per table when transactions are used.
So if you are deleting a lot of records and want to optimize the operation just wrap the delete calls in Doctrine_Connection transaction.
The Doctrine_Collection method count returns the number of elements currently in the collection.
Doctrine_Collection is a collection of records (see Doctrine_Record). As with records the collections can be deleted and saved using
Doctrine_Collection::delete() and Doctrine_Collection::save() accordingly.
<br \><br \>
When fetching data from database with either DQL API (see Doctrine_Query) or rawSql API (see Doctrine_RawSql) the methods return an instance of
Doctrine_Collection by default.
<br \><br \>
The following example shows how to initialize a new collection:
As with records the collection can be saved by calling the save method.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment