[PATCH] testbot: Document a quirk of Collection::Add().

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] testbot: Document a quirk of Collection::Add().

Francois Gouget
Not only does it not force loading from the database, it marks the
Collection as loaded. So if Add() is the first call on a Collection,
calling GetKeys() or GetItems() later on will only return the new
Item.

Signed-off-by: Francois Gouget <[hidden email]>
---
 testbot/lib/ObjectModel/Collection.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm
index 9d3d3aef..1b29ec16 100644
--- a/testbot/lib/ObjectModel/Collection.pm
+++ b/testbot/lib/ObjectModel/Collection.pm
@@ -168,6 +168,11 @@ sub Load($)
 
 Instantiates a new Item and adds it to the Collection.
 
+Note that not only does calling Add() not force loading from the database,
+it marks the Collection as loaded. So if Add() is the first call on a
+Collection, calling GetKeys() or GetItems() later on will only return the new
+Item.
+
 See Item->new() for details on the Item's default column values and for
 important information regarding its primary key.
 
--
2.15.0