From: Matt S Trout Date: Fri, 15 Nov 2013 11:34:10 +0000 (+0000) Subject: move reverse_relationship_info "is join a hashref" check into __strip_relcond X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e4630d9da0b5bb930a26591ed26e10c54a0a6652;p=dbsrgits%2FDBIx-Class.git move reverse_relationship_info "is join a hashref" check into __strip_relcond --- diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index d758ed7..bad4876 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -1444,10 +1444,10 @@ sub reverse_relationship_info { my $ret = {}; - return $ret unless ((ref $rel_info->{cond}) eq 'HASH'); - my $stripped_cond = $self->__strip_relcond ($rel_info->{cond}); + return $ret unless $stripped_cond; + my $registered_source_name = $self->source_name; # this may be a partial schema or something else equally esoteric @@ -1478,9 +1478,10 @@ sub reverse_relationship_info { # this can happen when we have a self-referential class next if $other_rel_info eq $rel_info; - next unless ref $other_rel_info->{cond} eq 'HASH'; my $other_stripped_cond = $self->__strip_relcond($other_rel_info->{cond}); + next unless $other_stripped_cond; + $ret->{$other_rel} = $other_rel_info if ( $self->_compare_relationship_keys ( [ keys %$stripped_cond ], [ values %$other_stripped_cond ] @@ -1497,6 +1498,7 @@ sub reverse_relationship_info { # all this does is removes the foreign/self prefix from a condition sub __strip_relcond { + return undef unless ref($_[1]) eq 'HASH'; +{ map { map { /^ (?:foreign|self) \. (\w+) $/x } ($_, $_[1]{$_}) }