Bugzilla – Attachment 147735 Details for
Bug 33080
Add helpers that return result_set for further processing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33080: (follow-up) Minor cleanups
Bug-33080-follow-up-Minor-cleanups.patch (text/plain), 3.98 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-03-03 19:57:28 UTC
(
hide
)
Description:
Bug 33080: (follow-up) Minor cleanups
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-03-03 19:57:28 UTC
Size:
3.98 KB
patch
obsolete
>From d697693aad336f713d26f74997e326caf2d63211 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 2 Mar 2023 16:41:31 +0000 >Subject: [PATCH] Bug 33080: (follow-up) Minor cleanups > >Whilst reviewing I spotted a few calls to the stash that were no longer >required and errors in the POD for the new/updated methods > >This patch adds fixes for those minor issues. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/Plugin/Objects.pm | 35 +++++++++++++++++++---------------- > 1 file changed, 19 insertions(+), 16 deletions(-) > >diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm >index 496b7cb8867..462fdf97da4 100644 >--- a/Koha/REST/Plugin/Objects.pm >+++ b/Koha/REST/Plugin/Objects.pm >@@ -38,10 +38,12 @@ sub register { > > my $patrons_rs = Koha::Patrons->new; > my $patrons = $c->objects->find( $patrons_rs, $id ); >+ . . . >+ return $c->render({ status => 200, openapi => $patron }); > > Performs a database search using given Koha::Objects object and the $id. > >-Returns I<undef> if no object is found Returns the I<API representation> of >+Returns I<undef> if no object is found or the I<API representation> of > the requested object. It passes through any embeds if specified. > > =cut >@@ -55,14 +57,18 @@ the requested object. It passes through any embeds if specified. > } > ); > >+ > =head3 objects.find_rs > > my $patrons_rs = Koha::Patrons->new; >- my $patrons = $c->objects->find_rs( $patrons_rs, $id ); >+ my $patron_rs = $c->objects->find_rs( $patrons_rs, $id ); >+ . . . >+ return $c->render({ status => 200, openapi => $patron_rs->to_api }); > >-Performs a database search using given Koha::Objects object and the $id. >+Returns the passed Koha::Objects resultset filtered to the passed $id and >+with any embeds requested by the api applied. > >-Returns a new resultset for further processing. It passes through any embeds if specified. >+The resultset can then be used for further processing. > > =cut > >@@ -72,10 +78,6 @@ Returns a new resultset for further processing. It passes through any embeds if > > my $attributes = {}; > >- # Look for embeds >- my $embed = $c->stash('koha.embed'); >- my $strings = $c->stash('koha.strings'); >- > # Generate prefetches for embedded stuff > $c->dbic_merge_prefetch( > { >@@ -94,8 +96,11 @@ Returns a new resultset for further processing. It passes through any embeds if > > my $patrons_rs = Koha::Patrons->new; > my $patrons = $c->objects->search( $patrons_rs ); >+ . . . >+ return $c->render({ status => 200, openapi => $patrons }); > >-Performs a database search using given Koha::Objects object and query parameters. >+Performs a database search using given Koha::Objects object with any api >+query parameters applied. > > Returns an arrayref of the hashrefs representing the resulting objects > for API rendering. >@@ -116,11 +121,12 @@ shouldn't be called twice in it. > =head3 objects.search_rs > > my $patrons_rs = Koha::Patrons->new; >- my $filtered_patrons_rs = $c->objects->search_rs( $patrons_rs ); >+ my $patrons_rs = $c->objects->search_rs( $patrons_rs ); >+ . . . >+ return $c->render({ status => 200, openapi => $patrons_rs->to_api }); > >-Performs a database search using given Koha::Objects object and query parameters. >- >-Returns a new resultset for further processing. >+Returns the passed Koha::Objects resultset filtered as requested by the api query >+parameters and with requested embeds applied. > > Warning: this helper adds pagination headers to the calling controller, and thus > shouldn't be called twice in it. >@@ -138,9 +144,6 @@ shouldn't be called twice in it. > my ( $filtered_params, $reserved_params, $path_params ) = > $c->extract_reserved_params($args); > >- # Privileged reques? >- my $is_public = $c->stash('is_public'); >- > # Merge sorting into query attributes > $c->dbic_merge_sorting( > { >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33080
:
147469
|
147662
|
147663
|
147720
|
147734
|
147735
|
147736
|
147788
|
147789
|
147790
|
147823
|
147824
|
147825
|
148020
|
148021
|
148022
|
148071
|
148072
|
148073