[Bast-commits] r4420 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Tue May 27 13:49:09 BST 2008
Author: ash
Date: 2008-05-27 13:49:09 +0100 (Tue, 27 May 2008)
New Revision: 4420
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Cookbook.pod
Log:
Add set_cache example to cookbook
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Cookbook.pod 2008-05-27 10:41:44 UTC (rev 4419)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Cookbook.pod 2008-05-27 12:49:09 UTC (rev 4420)
@@ -763,6 +763,23 @@
Which will of course only work if your database supports this function.
See L<DBIx::Class::ResultSetColumn> for more documentation.
+=head2 Creating a result set from a set of rows
+
+Sometimes you have a (set of) row objects that you want to put into a
+resultset without the need to hit the DB again. You can do that by using the
+L<set_cache|DBIx::Class::Resultset/set_cache> method:
+
+ my @rows;
+ while (my $group = $groups->next) {
+ if ($group->can_upload($self)) {
+ push @uploadable_groups, $group;
+ }
+ }
+ my $new_rs = $self->result_source->resultset;
+ $new_rs->set_cache(\@uploadable_groups);
+ return $new_rs;
+
+
=head1 USING RELATIONSHIPS
=head2 Create a new row in a related table
More information about the Bast-commits
mailing list