From d93a8f4696ae323b8e0e5851049b3f52e4c7afc6 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 2 Feb 2021 16:22:07 -0300 Subject: [PATCH] Bug 26636: (QA follow-up) Add POD Sponsored-by: Virginia Tech Libraries Signed-off-by: Tomas Cohen Arazi Signed-off-by: Andrew Fuerste-Henry --- Koha/REST/Plugin/Objects.pm | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm index 635f6d08c7..5fc6303020 100644 --- a/Koha/REST/Plugin/Objects.pm +++ b/Koha/REST/Plugin/Objects.pm @@ -29,21 +29,23 @@ Koha::REST::Plugin::Objects =head2 Helper methods -=head3 objects.search +=cut + +sub register { + my ( $self, $app ) = @_; + +=head3 objects.find my $patrons_rs = Koha::Patrons->new; - my $patrons = $c->objects->search( $patrons_rs ); + my $patrons = $c->objects->find( $patrons_rs, $id ); -Performs a database search using given Koha::Objects object and query parameters. +Performs a database search using given Koha::Objects object and the $id. -Returns an arrayref of the hashrefs representing the resulting objects -for API rendering. +Returns I if no object is found Returns the I of +the requested object. It passes through any embeds if specified. =cut -sub register { - my ( $self, $app ) = @_; - $app->helper( 'objects.find' => sub { my ( $c, $result_set, $id ) = @_; @@ -66,6 +68,18 @@ sub register { } ); +=head3 objects.search + + my $patrons_rs = Koha::Patrons->new; + my $patrons = $c->objects->search( $patrons_rs ); + +Performs a database search using given Koha::Objects object and query parameters. + +Returns an arrayref of the hashrefs representing the resulting objects +for API rendering. + +=cut + $app->helper( 'objects.search' => sub { my ( $c, $result_set ) = @_; -- 2.11.0