diff --git a/manual/docs/Basic Components - Collection - Adding new elements.php b/manual/docs/Basic Components - Collection - Adding new elements.php new file mode 100644 index 000000000..62239965f --- /dev/null +++ b/manual/docs/Basic Components - Collection - Adding new elements.php @@ -0,0 +1,6 @@ +When accessing single elements of the collection and those elements (records) don't exist Doctrine auto-adds them. +

+In the following example +we fetch all users from database (there are 5) and then add couple of users in the collection. +

+As with PHP arrays the indexes start from zero. diff --git a/manual/docs/Basic Components - Collection - Collection expanding.php b/manual/docs/Basic Components - Collection - Collection expanding.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/docs/Basic Components - Collection - Deleting collection.php b/manual/docs/Basic Components - Collection - Deleting collection.php index a33028dc2..b8776bc01 100644 --- a/manual/docs/Basic Components - Collection - Deleting collection.php +++ b/manual/docs/Basic Components - Collection - Deleting collection.php @@ -7,3 +7,7 @@ of users doctrine only performs two queries for this whole transaction. The quer

DELETE FROM user WHERE id IN (1,2,3, ... ,N)
DELETE FROM phonenumber WHERE id IN (1,2,3, ... ,M)
+

+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. + diff --git a/manual/docs/Basic Components - Collection - Getting collection count.php b/manual/docs/Basic Components - Collection - Getting collection count.php new file mode 100644 index 000000000..b69b6fad3 --- /dev/null +++ b/manual/docs/Basic Components - Collection - Getting collection count.php @@ -0,0 +1 @@ +The Doctrine_Collection method count returns the number of elements currently in the collection. diff --git a/manual/docs/Basic Components - Collection - Introduction.php b/manual/docs/Basic Components - Collection - Introduction.php new file mode 100644 index 000000000..d446c7a90 --- /dev/null +++ b/manual/docs/Basic Components - Collection - Introduction.php @@ -0,0 +1,7 @@ +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. +

+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. +

+The following example shows how to initialize a new collection: diff --git a/manual/docs/Basic Components - Collection - Saving the collection.php b/manual/docs/Basic Components - Collection - Saving the collection.php new file mode 100644 index 000000000..0d937c242 --- /dev/null +++ b/manual/docs/Basic Components - Collection - Saving the collection.php @@ -0,0 +1 @@ +As with records the collection can be saved by calling the save method.