From: Daniel Westermann-Clark Date: Fri, 26 May 2006 00:16:45 +0000 (+0000) Subject: Hack for now, constraint in find if a key is specified X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c8291bda3bb51eeb3e0fab37c28e424e7396d002;p=dbsrgits%2FDBIx-Class-Historic.git Hack for now, constraint in find if a key is specified --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 9b5a42b..0014064 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -310,6 +310,11 @@ sub find { $query = {@_}; } + if (exists $attrs->{key}) { + my @unique_cols = $self->result_source->unique_constraint_columns($attrs->{key}); + $query = $self->_build_unique_query($query, \@unique_cols); + } + # Add the ResultSet's alias foreach my $key (grep { ! m/\./ } keys %$query) { $query->{"$self->{attrs}{alias}.$key"} = delete $query->{$key};