Probably fixed an incipient bug in prefetch
Matt S Trout [Wed, 11 Jan 2006 01:54:09 +0000 (01:54 +0000)]
lib/DBIx/Class/Row.pm

index b64711e..b33a3e9 100644 (file)
@@ -257,13 +257,13 @@ sub inflate_result {
     my $fetched = $pre_class->inflate_result(@{$prefetch->{$pre}});
     $class->throw("No accessor for prefetched $pre")
       unless defined $rel_obj->{attrs}{accessor};
-    if ($rel_obj->{attrs}{accessor} eq 'single') {
-      PRIMARY: foreach my $pri ($rel_obj->{class}->primary_columns) {
-        unless (defined $fetched->get_column($pri)) {
-          undef $fetched;
-          last PRIMARY;
-        }
+    PRIMARY: foreach my $pri ($rel_obj->{class}->primary_columns) {
+      unless (defined $fetched->get_column($pri)) {
+        undef $fetched;
+        last PRIMARY;
       }
+    }
+    if ($rel_obj->{attrs}{accessor} eq 'single') {
       $new->{_relationship_data}{$pre} = $fetched;
     } elsif ($rel_obj->{attrs}{accessor} eq 'filter') {
       $new->{_inflated_column}{$pre} = $fetched;