removed the mistaken debug code
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Ordered.pm
index 88e1110..737477d 100644 (file)
@@ -18,6 +18,26 @@ Create a table for your ordered data.
     position INTEGER NOT NULL
   );
 
+Optionally, add one or more columns to specify groupings, allowing you 
+to maintain independent ordered lists within one table:
+
+  CREATE TABLE items (
+    item_id INTEGER PRIMARY KEY AUTOINCREMENT,
+    name TEXT NOT NULL,
+    position INTEGER NOT NULL,
+    group_id INTEGER NOT NULL
+  );
+
+Or even
+
+  CREATE TABLE items (
+    item_id INTEGER PRIMARY KEY AUTOINCREMENT,
+    name TEXT NOT NULL,
+    position INTEGER NOT NULL,
+    group_id INTEGER NOT NULL,
+    other_group_id INTEGER NOT NULL
+  );
+
 In your Schema or DB class add "Ordered" to the top 
 of the component list.
 
@@ -29,6 +49,14 @@ each row.
   package My::Item;
   __PACKAGE__->position_column('position');
 
+If you are using one grouping column, specify it as follows:
+
+  __PACKAGE__->grouping_column('group_id');
+
+Or if you have multiple grouping columns:
+
+  __PACKAGE__->grouping_column(['group_id', 'other_group_id']);
+
 That's it, now you can change the position of your objects.
 
   #!/use/bin/perl
@@ -443,8 +471,8 @@ need to use them.
 
 =head2 _grouping_clause
 
-This method returns a name=>value pair for limiting a search 
-by the collection column.  If the collection column is not 
+This method returns one or more name=>value pairs for limiting a search 
+by the grouping column(s).  If the grouping column is not 
 defined then this will return an empty list.
 
 =cut