Bug 22701

Summary: Make items prefetchable from Koha::Biblio
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: kyle, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 22407, 22696    
Attachments: Bug 22701: Unit tests for Koha::Biblio->items
Bug 22701: Make items prefetchable from Koha::Biblio
Bug 22701: Unit tests for Koha::Biblio->items
Bug 22701: Make items prefetchable from Koha::Biblio

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.