[Bast-commits] r4551 - DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass

ash at dev.catalyst.perl.org ash at dev.catalyst.perl.org
Wed Jul 2 15:53:32 BST 2008


Author: ash
Date: 2008-07-02 15:53:32 +0100 (Wed, 02 Jul 2008)
New Revision: 4551

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass/HashRefInflator.pm
Log:
Add caveat about prefetch

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass/HashRefInflator.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass/HashRefInflator.pm	2008-07-01 12:21:31 UTC (rev 4550)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass/HashRefInflator.pm	2008-07-02 14:53:32 UTC (rev 4551)
@@ -87,4 +87,21 @@
     };
 }
 
+=head1 CAVEAT
+
+This will not work for relationships that have been prefetched. Consider the
+following:
+
+ my $artist = $artitsts_rs->search({}, {prefetch => 'cds' })->first;
+
+ my $cds = $artist->cds;
+ $cds->result_class('DBIx::Class::ResultClass::HashRefInflator');
+ my $first = $cds->first; 
+
+C<$first> will B<not> be a hashref, it will be a normal CD row since 
+HashRefInflator only affects resultsets at inflation time, and prefetch causes
+relations to be inflated when the master C<$artist> row is inflated.
+
+=cut
+
 1;




More information about the Bast-commits mailing list