Bugzilla – Attachment 117670 Details for
Bug 26636
Add objects.find Mojolicious helper
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26636: Add objects.find helper
Bug-26636-Add-objectsfind-helper.patch (text/plain), 1.55 KB, created by
Martin Renvoize (ashimema)
on 2021-03-04 10:34:13 UTC
(
hide
)
Description:
Bug 26636: Add objects.find helper
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-03-04 10:34:13 UTC
Size:
1.55 KB
patch
obsolete
>From c2e619e4eb14c7b490e0546a172a155f928b4a3a Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Fri, 9 Oct 2020 10:20:33 -0300 >Subject: [PATCH] Bug 26636: Add objects.find helper > >This patch adds the objects.find helper. Much like objects.search, it >returns the to_api method with embedded. > >Sponsored-by: Virginia Polytechnic Institute and State University > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/Plugin/Objects.pm | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > >diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm >index 246aece704..635f6d08c7 100644 >--- a/Koha/REST/Plugin/Objects.pm >+++ b/Koha/REST/Plugin/Objects.pm >@@ -44,6 +44,28 @@ for API rendering. > sub register { > my ( $self, $app ) = @_; > >+ $app->helper( >+ 'objects.find' => sub { >+ my ( $c, $result_set, $id ) = @_; >+ >+ my $attributes = {}; >+ >+ # Look for embeds >+ my $embed = $c->stash('koha.embed'); >+ # Generate prefetches for embedded stuff >+ $c->dbic_merge_prefetch( >+ { >+ attributes => $attributes, >+ result_set => $result_set >+ } >+ ); >+ >+ my $object = $result_set->find( $id, $attributes ); >+ >+ return $object->to_api({ embed => $embed }); >+ } >+ ); >+ > $app->helper( > 'objects.search' => sub { > my ( $c, $result_set ) = @_; >-- >2.20.1
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 26636
:
111418
|
111419
|
116222
|
116223
|
116224
|
116225
|
116226
|
116227
|
116228
|
116229
|
116230
|
116231
|
116594
|
116595
|
116596
|
116597
|
116598
|
117669
| 117670 |
117671
|
117672
|
117673
|
127528
|
127529
|
127530
|
127531
|
127532