Bug 22033 - related_resultset is a hole in the Koha::Object logic
Summary: related_resultset is a hole in the Koha::Object logic
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Jonathan Druart
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-20 16:57 UTC by Martin Renvoize (ashimema)
Modified: 2020-06-04 20:32 UTC (History)
3 users (show)

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


Attachments
Bug 22033: Remove related_resultset from the list of available methods (1.27 KB, patch)
2018-12-20 21:56 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22033: Remove related_resultset from the list of available methods (1.33 KB, patch)
2018-12-21 08:33 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 Martin Renvoize (ashimema) 2018-12-20 16:57:38 UTC
related_resultset is in the known_methods array and as such is allowed to be called via any existing Koha::Object result.

This method is untested (I thought all methods being passed through required full testing koha side.. at least that's what I had been lead to beleive).

This method returns a DBIx::Class::ResultSet and not a Koha::Objects result class and as such introduces inconsistent behaviour.. we should have it remain consistent and have a localised method to convert the result to a Koha::Object derived class..

Personally, one of my biggest disappointments with Koha::Objects is that we don't get the relationship accessors provided by DBIx::Class
Comment 1 Jonathan Druart 2018-12-20 21:56:37 UTC
Created attachment 83432 [details] [review]
Bug 22033: Remove related_resultset from the list of available methods

It is not covered by tests.
Comment 2 Jonathan Druart 2018-12-20 21:56:55 UTC
It is a mistake, it should not be there.
Comment 3 Martin Renvoize (ashimema) 2018-12-21 08:33:13 UTC
Created attachment 83441 [details] [review]
Bug 22033: Remove related_resultset from the list of available methods

It is not covered by tests.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize (ashimema) 2018-12-21 08:34:30 UTC
Trivial patch, going straight for PQA
Comment 5 Nick Clemens (kidclamp) 2018-12-26 20:51:14 UTC
Awesome work all!

Pushed to master for 19.05
Comment 6 Martin Renvoize (ashimema) 2019-01-03 14:18:40 UTC
Pushed to 18.11.x for 18.11.02.

I chose to backport this to the 18.11.x as we're early in the cycle. I don't feel it's required for earlier releases however as it's a precautionary measure to prevent it's misuse in future developments.

Marking RESOLVED FIXED