https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19410

--- Comment #37 from Kyle M Hall <[email protected]> ---
I think rather than calling _to_model in each Controller, we should move that
call to Koha::REST::Plugin::Objects, something like

diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm
index eb3f951..163e364 100644
--- a/Koha/REST/Plugin/Objects.pm
+++ b/Koha/REST/Plugin/Objects.pm
@@ -45,7 +45,7 @@ sub register {
         'objects.search' => sub {
             my ( $c, $objects_set ) = @_;

-            my $args = $c->validation->output;
+            my $args = $objects_set->_to_model( $c->validation->output );
             my $attributes = {};

and change the extract to
my ($params, $reserved_params) = $c->extract_reserved_params(
$c->validation->output );
or something like that so the above 'patch' doesn't break it.

We could add _to_model to a parent class of the modules in Koha::REST::V1 that
essentially does nothing, and then each child class could override it with any
customizations if necessary.

That would simplify the code, and allow customization easily, if it is needed.
If it isn't the class just won't have a _to_model method.

This is probably better to implement in a followup bug report. That patches
themselves appear to work great!

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to