# return $e->event unless @$results;
# -----------------------------------------------------------------------------
sub runmethod {
- my( $self, $action, $type, $arg, $options ) = @_;
+ my( $self, $action, $type, $hint, $arg, $options ) = @_;
$options ||= {};
my @arg = ( ref($arg) eq 'ARRAY' ) ? @$arg : ($arg);
my $method = '';
if ($self->personality eq 'open-ils.pcrud') {
- $method = $self->app.".$action.$type";
+ $method = $self->app.".$action.$hint";
} else {
$method = $self->app.".direct.$type.$action";
}
my $map = $Fieldmapper::fieldmap;
for my $object (keys %$map) {
my $obj = __fm2meth($object, '_');
- my $type;
- if (__PACKAGE__->personality eq 'open-ils.pcrud') {
- $type = $object->json_hint;
- } else {
- $type = __fm2meth($object, '.');
- }
+ my $type = __fm2meth($object, '.');
+ my $hint = $object->json_hint;
foreach my $command (qw/ update retrieve search create delete batch_retrieve retrieve_all /) {
- eval "sub ${command}_$obj {return shift()->runmethod('$command', '$type', \@_);}\n";
+ eval "sub ${command}_$obj {return shift()->runmethod('$command', '$type', '$hint', \@_);}\n";
}
# TODO: performance test against concatenating a big string of all the subs and eval'ing only ONCE.
}