_launder_keys($filter) unless $params{no_launder};
return
- query => $query,
- @$objects ? ( with_objects => [ uniq @$objects ]) : ();
+ ($query && @$query ? (query => $query) : ()),
+ ($objects && @$objects ? ( with_objects => [ uniq @$objects ]) : ());
}
sub _launder_keys {
my ($filter, $with_objects, $prefix, %params) = @_;
return () unless 'HASH' eq ref $filter;
- $with_objects = [];
+ $with_objects ||= [];
my @result;
}
test { }, {
- query => []
}, 'minimal test';
test {
}
}, {
query => [ 'customer.chart.accno' => 'test' ],
- with_objects => [ 'customer', 'chart' ],
+ with_objects => bag( 'customer', 'chart' ),
}, 'nested joins';
test {
},
{
query => [ 'customer.chart.accno' => { like => '%1200' } ],
- with_objects => ['customer', 'chart' ],
+ with_objects => bag('customer', 'chart' ),
}, 'all together';
'invoice.customer.name' => 'test',
'customer.name' => 'test',
}} ],
- 'with_objects' => [
- 'invoice',
- 'customer'
- ]
+ 'with_objects' => bag( 'invoice', 'customer' )
}, 'object in more than one relationship';
test {