POD'd result_class func
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSet.pm
index 992f6c0..611df76 100644 (file)
@@ -766,6 +766,20 @@ sub _collapse_result {
 An accessor for the primary ResultSource object from which this ResultSet
 is derived.
 
+=head2 result_class
+
+=over 4
+
+=item Arguments: $result_class?
+
+=item Return Value: $result_class
+
+=back
+
+An accessor for the class to use when creating row objects. Defaults to 
+C<< result_source->result_class >> - which in most cases is the name of the 
+L<"table"|DBIx::Class::Manual::Glossary/"ResultSource"> class.
+
 =cut
 
 
@@ -1432,7 +1446,7 @@ sub related_resultset {
         alias => $alias,
         where => $self->{cond},
         seen_join => $seen,
-        _parent_from => $from,
+        from => $from,
     });
   };
 }
@@ -1442,7 +1456,7 @@ sub _resolve_from {
   my $source = $self->result_source;
   my $attrs = $self->{attrs};
   
-  my $from = $attrs->{_parent_from}
+  my $from = $attrs->{from}
     || [ { $attrs->{alias} => $source->from } ];
     
   my $seen = { %{$attrs->{seen_join}||{}} };
@@ -1494,8 +1508,7 @@ sub _resolved_attrs {
     push(@{$attrs->{as}}, @$adds);
   }
 
-  $attrs->{from} ||= delete $attrs->{_parent_from}
-    || [ { 'me' => $source->from } ];
+  $attrs->{from} ||= [ { 'me' => $source->from } ];
 
   if (exists $attrs->{join} || exists $attrs->{prefetch}) {
     my $join = delete $attrs->{join} || {};
@@ -1506,9 +1519,11 @@ sub _resolved_attrs {
       );
     }
 
-    push(@{$attrs->{from}},
-      $source->resolve_join($join, $alias, { %{$attrs->{seen_join}||{}} })
-    );
+    $attrs->{from} =   # have to copy here to avoid corrupting the original
+      [
+        @{$attrs->{from}}, 
+        $source->resolve_join($join, $alias, { %{$attrs->{seen_join}||{}} })
+      ];
   }
 
   $attrs->{group_by} ||= $attrs->{select} if delete $attrs->{distinct};