X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FAccessor.pm;h=0c19ef1c19a488d43ed3d1fdd1930770a5e01329;hb=b28cc0ba2d1d443728c9cb48d97e5a2cdccf8cb4;hp=2350b81b44d31a71a692e61e4b3aedab9ec704c0;hpb=4a07648ace2ace5b878c63aec52b7a30c1432b4d;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Relationship/Accessor.pm b/lib/DBIx/Class/Relationship/Accessor.pm index 2350b81..0c19ef1 100644 --- a/lib/DBIx/Class/Relationship/Accessor.pm +++ b/lib/DBIx/Class/Relationship/Accessor.pm @@ -25,8 +25,9 @@ sub _add_relationship_accessor { } elsif (exists $self->{_relationship_data}{$rel}) { return $self->{_relationship_data}{$rel}; } else { - return $self->{_relationship_data}{$rel} - = $self->find_or_create_related($rel, {}, {}); + my ($val) = $self->search_related($rel, {}, {}); + return unless $val; + return $self->{_relationship_data}{$rel} = $val; } }; } elsif ($acc_type eq 'filter') {