work of fetching rows and representing them as objects. It is a good
model to copy if you're replacing it with other database abstraction
modules.
work of fetching rows and representing them as objects. It is a good
model to copy if you're replacing it with other database abstraction
modules.
- my $related = $self->related->{$accessor};
- if ( my $mapping = $related->{args}->{mapping} ) {
+
+ my $related = $self->meta_info( has_many => $accessor ) ||
+ $self->meta_info( has_a => $accessor ) ||
+ return;
+
+ my $mapping = $related->{args}->{mapping};
+ if ( @$mapping ) {
my $oper = "like"; # For now
my %params = %{ $r->{params} };
my %values = map { $_ => { $oper, $params{$_} } }
my $oper = "like"; # For now
my %params = %{ $r->{params} };
my %values = map { $_ => { $oper, $params{$_} } }
- if ( $order = $r->query->{order} and $ok_columns{$order} ) {
- $order .= ( $r->query->{o2} eq "desc" && " DESC" );
- }
- $order;
+ my $q = $r->query;
+ my $order = $q->{order};
+ return unless $order and $ok_columns{$order};
+ $order .= ' DESC' if $q->{o2} and $q->{o2} eq 'desc';
+ return $order;