X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship.pm;h=14741b0ee30ab594d72ccd4d9ea7f5037d978df2;hb=656796f2088da66cc80f4eb127c39c923ef3c1dd;hp=da768acf547bbe9bf972290356d5ea59ffe14515;hpb=b28cc0ba2d1d443728c9cb48d97e5a2cdccf8cb4;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Relationship.pm b/lib/DBIx/Class/Relationship.pm index da768ac..14741b0 100644 --- a/lib/DBIx/Class/Relationship.pm +++ b/lib/DBIx/Class/Relationship.pm @@ -104,6 +104,18 @@ sub _cond_value { sub search_related { my $self = shift; + return $self->_literal_related('search', @_); +} + +sub count_related { + my $self = shift; + return $self->_literal_related('count', @_); +} + +sub _literal_related { + my $self = shift; + my $op = shift; + my $meth = "${op}_literal"; my $rel = shift; my $attrs = { }; if (@_ > 1 && ref $_[$#_] eq 'HASH') { @@ -118,11 +130,12 @@ sub search_related { my $query = ((@_ > 1) ? {@_} : shift); $s_cond = $self->_cond_resolve($query, $attrs); } - $attrs->{_action} = 'convert'; + $attrs->{_action} = 'convert'; # shouldn't we resolve the cond to something + # to merge into the AST really? my ($cond) = $self->_cond_resolve($rel_obj->{cond}, $attrs); $cond = "${s_cond} AND ${cond}" if $s_cond; - return $rel_obj->{class}->retrieve_from_sql($cond, @{$attrs->{bind} || []}, - $attrs); + #warn $rel_obj->{class}." $meth $cond ".join(', ', @{$attrs->{bind}}); + return $rel_obj->{class}->$meth($cond, @{$attrs->{bind} || []}, $attrs); } sub create_related {