Various method POD changes
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Relationship / Base.pm
index 6cfe28c..e38ab2d 100644 (file)
@@ -412,6 +412,31 @@ sub register_relationship { }
 Returns a L<DBIx::Class::ResultSet> for the relationship named
 $relationship_name.
 
+=head2 $relationship_accessor
+
+=over 4
+
+=item Arguments: None
+
+=item Return Value: $row_object | $related_resultset | undef
+
+=back
+
+  # These pairs do the same thing
+  $row = $cd->related_resultset('artist')->single;  # has_one relationship
+  $row = $cd->artist;
+  $rs = $cd->related_resultset('tracks');           # has_many relationship
+  $rs = $cd->tracks;
+
+This is the recommended way to transverse through relationships, based
+on the L</accessor> name given in the relationship definition.
+
+This will return either a L<Row|DBIx::Class::Row> or a
+L<ResultSet|DBIx::Class::ResultSet>, depending on if the relationship is
+C<single> (returns only one row) or C<multi> (returns many rows).  The
+method may also return C<undef> if the relationship doesn't exist for
+this instance (like in the case of C<might_have> relationships).
+
 =cut
 
 sub related_resultset {
@@ -571,7 +596,7 @@ on it.
 =cut
 
 sub new_related {
-  my ($self, $rel, $values, $attrs) = @_;
+  my ($self, $rel, $values) = @_;
 
   # FIXME - this is a bad position for this (also an identical copy in
   # set_from_related), but I have no saner way to hook, and I absolutely
@@ -600,8 +625,7 @@ sub new_related {
     }
   }
 
-  my $row = $self->search_related($rel)->new($values, $attrs);
-  return $row;
+  return $self->search_related($rel)->new_result($values);
 }
 
 =head2 create_related
@@ -845,9 +869,9 @@ Removes the link between the current object and the related object. Note that
 the related object itself won't be deleted unless you call ->delete() on
 it. This method just removes the link between the two objects.
 
-=head1 AUTHORS
+=head1 AUTHOR AND CONTRIBUTORS
 
-Matt S. Trout <mst@shadowcatsystems.co.uk>
+See L<AUTHOR|DBIx::Class/AUTHOR> and L<CONTRIBUTORS|DBIx::Class/CONTRIBUTORS> in DBIx::Class
 
 =head1 LICENSE