From: Guillermo Roditi Date: Tue, 16 Dec 2008 23:27:57 +0000 (+0000) Subject: somehow i messed up the merge. this fixes it X-Git-Tag: v0.08240~218 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7a7e8718d1252135a80288994993227398cc2fa9;p=dbsrgits%2FDBIx-Class.git somehow i messed up the merge. this fixes it --- diff --git a/lib/DBIx/Class/Relationship/Accessor.pm b/lib/DBIx/Class/Relationship/Accessor.pm index d9c24a4..dcb906e 100644 --- a/lib/DBIx/Class/Relationship/Accessor.pm +++ b/lib/DBIx/Class/Relationship/Accessor.pm @@ -18,7 +18,7 @@ sub add_relationship_accessor { my ($class, $rel, $acc_type) = @_; my %meth; if ($acc_type eq 'single') { - my $rel_cond = $class->relationship_info($rel)->{cond}; + my $rel_info = $class->relationship_info($rel); $meth{$rel} = sub { my $self = shift; if (@_) { @@ -28,9 +28,11 @@ sub add_relationship_accessor { return $self->{_relationship_data}{$rel}; } else { my $cond = $self->result_source->resolve_condition( - $rel_cond, $rel, $self + $rel_info->{cond}, $rel, $self ); - return if grep { not defined } values %$cond; + if ($rel_info->{attrs}->{undef_on_null_fk}){ + return if grep { not defined } values %$cond; + } my $val = $self->find_related($rel, {}, {}); return unless $val; return $self->{_relationship_data}{$rel} = $val;