Bugzilla – Attachment 88491 Details for
Bug 22701
Make items prefetchable from Koha::Biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22701: Make items prefetchable from Koha::Biblio
Bug-22701-Make-items-prefetchable-from-KohaBiblio.patch (text/plain), 1.37 KB, created by
Martin Renvoize (ashimema)
on 2019-04-23 14:25:24 UTC
(
hide
)
Description:
Bug 22701: Make items prefetchable from Koha::Biblio
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-04-23 14:25:24 UTC
Size:
1.37 KB
patch
obsolete
>From f95cbc183b26deff7002686b8d236206bb9c3c1c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 22 Apr 2019 10:08:41 -0300 >Subject: [PATCH] Bug 22701: Make items prefetchable from Koha::Biblio > >This patch makes Koha::Biblio->items use _new_from_dbic instead of >calling Koha::Items->search. This allows calling it with prefetch >enabled for the items relationship. No noticeable behaviour change takes >place besides this. > >To test: >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Biblio.t >=> SUCCESS: Tests pass! >- Apply this patch >- Run: > k$ prove t/db_dependent/Koha/Biblio.t >=> SUCCESS: Tests still pass! >- Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Biblio.pm | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 56f91859d5..5389d6b688 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -362,9 +362,12 @@ or list of Koha::Item objects in list context. > sub items { > my ($self) = @_; > >- $self->{_items} ||= Koha::Items->search( { biblionumber => $self->biblionumber() } ); >+ my $items_rs = $self->_result->items; > >- return wantarray ? $self->{_items}->as_list : $self->{_items}; >+ return >+ wantarray >+ ? Koha::Items->_new_from_dbic($items_rs)->as_list >+ : Koha::Items->_new_from_dbic($items_rs); > } > > =head3 itemtype >-- >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 22701
:
88374
|
88375
|
88490
| 88491