Bug 22701 - Make items prefetchable from Koha::Biblio
Summary: Make items prefetchable from Koha::Biblio
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 22407 22696
  Show dependency treegraph
 
Reported: 2019-04-12 18:35 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2020-01-06 20:14 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.00
Circulation function:


Attachments
Bug 22701: Unit tests for Koha::Biblio->items (1.65 KB, patch)
2019-04-22 13:12 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 22701: Make items prefetchable from Koha::Biblio (1.31 KB, patch)
2019-04-22 13:12 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 22701: Unit tests for Koha::Biblio->items (1.71 KB, patch)
2019-04-23 14:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 22701: Make items prefetchable from Koha::Biblio (1.37 KB, patch)
2019-04-23 14:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2019-04-12 18:35:27 UTC

    
Comment 1 Tomás Cohen Arazi (tcohen) 2019-04-22 13:12:17 UTC
Created attachment 88374 [details] [review]
Bug 22701: Unit tests for Koha::Biblio->items

This patch adds tests fr the current items() implementation. The idea is
to verify no behaviour change takes place after we make it us
_new_from_dbic instead of calling Koha::Items->search.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass!
- Sign off :-D
Comment 2 Tomás Cohen Arazi (tcohen) 2019-04-22 13:12:55 UTC
Created attachment 88375 [details] [review]
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
Comment 3 Martin Renvoize (ashimema) 2019-04-23 14:25:21 UTC
Created attachment 88490 [details] [review]
Bug 22701: Unit tests for Koha::Biblio->items

This patch adds tests fr the current items() implementation. The idea is
to verify no behaviour change takes place after we make it us
_new_from_dbic instead of calling Koha::Items->search.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize (ashimema) 2019-04-23 14:25:24 UTC
Created attachment 88491 [details] [review]
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>
Comment 5 Martin Renvoize (ashimema) 2019-04-23 14:25:56 UTC
Looks solid to me and works as expected.. Signing off
Comment 6 Martin Renvoize (ashimema) 2019-04-23 14:53:00 UTC
Trivial patch.. turning this into a PQA.
Comment 7 Nick Clemens (kidclamp) 2019-04-24 11:48:41 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize (ashimema) 2019-04-26 14:58:27 UTC
Enhancement will not be backported to 18.11.x series.