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

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


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
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 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 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 2018-12-21 08:34:30 UTC
Trivial patch, going straight for PQA
Comment 5 Nick Clemens 2018-12-26 20:51:14 UTC
Awesome work all!

Pushed to master for 19.05
Comment 6 Martin Renvoize 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