X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FBase.pm;h=96b7c189132b50ef0b270a68b277a281019bb00a;hb=2c037e6bd80a384bbf00b46ad91a7b36251f080b;hp=9ea8cff1062c421caeea30325709b634d461cadc;hpb=27f01d1f4fc106e0d27a13c6f6c9d5fa131e9447;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 9ea8cff..96b7c18 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -5,7 +5,7 @@ use warnings; use base qw/DBIx::Class/; -=head1 NAME +=head1 NAME DBIx::Class::Relationship::Base - Inter-table relationships @@ -15,7 +15,7 @@ DBIx::Class::Relationship::Base - Inter-table relationships This class provides methods to describe the relationships between the tables in your database model. These are the "bare bones" relationships -methods, for predefined ones, look in L. +methods, for predefined ones, look in L. =head1 METHODS @@ -23,7 +23,7 @@ methods, for predefined ones, look in L. =over 4 -=item Arguments: ('relname', 'Foreign::Class', $cond, $attrs) +=item Arguments: 'relname', 'Foreign::Class', $cond, $attrs =back @@ -31,8 +31,8 @@ methods, for predefined ones, look in L. The condition needs to be an SQL::Abstract-style representation of the join between the tables. When resolving the condition for use in a JOIN, -keys using the psuedo-table I are resolved to mean "the Table on the -other side of the relationship", and values using the psuedo-table I +keys using the pseudo-table I are resolved to mean "the Table on the +other side of the relationship", and values using the pseudo-table I are resolved to mean "the Table this class is representing". Other restrictions, such as by value, sub-select and other tables, may also be used. Please check your database for JOIN parameter support. @@ -92,7 +92,7 @@ created, which calls C for the relationship. =over 4 -=item Arguments: ($relname, $rel_info) +=item Arguments: $relname, $rel_info =back @@ -107,9 +107,9 @@ sub register_relationship { } =over 4 -=item Arguments: ($relationship_name) +=item Arguments: $relationship_name -=item Returns: $related_resultset +=item Return Value: $related_resultset =back @@ -276,9 +276,11 @@ sub set_from_related { "condition for $rel is of type ". (ref $cond ? ref $cond : 'plain scalar') ) unless ref $cond eq 'HASH'; - my $f_class = $self->result_source->schema->class($rel_obj->{class}); - $self->throw_exception( "Object $f_obj isn't a ".$f_class ) - unless $f_obj->isa($f_class); + if (defined $f_obj) { + my $f_class = $self->result_source->schema->class($rel_obj->{class}); + $self->throw_exception( "Object $f_obj isn't a ".$f_class ) + unless $f_obj->isa($f_class); + } $self->set_columns( $self->result_source->resolve_condition( $rel_obj->{cond}, $f_obj, $rel));