From: Ash Berlin Date: Wed, 2 Jul 2008 14:53:32 +0000 (+0000) Subject: Add caveat about prefetch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=419ff18467b5fb8142cc33f2aac9e06237937b72;p=dbsrgits%2FDBIx-Class-Historic.git Add caveat about prefetch --- diff --git a/lib/DBIx/Class/ResultClass/HashRefInflator.pm b/lib/DBIx/Class/ResultClass/HashRefInflator.pm index 4aa362a..fc0ee37 100644 --- a/lib/DBIx/Class/ResultClass/HashRefInflator.pm +++ b/lib/DBIx/Class/ResultClass/HashRefInflator.pm @@ -87,4 +87,21 @@ sub mk_hash { }; } +=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 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;