Bug 22033

Summary: related_resultset is a hole in the Koha::Object logic
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: minor    
Priority: P5 - low CC: jonathan.druart, katrin.fischer, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 22033: Remove related_resultset from the list of available methods
Bug 22033: Remove related_resultset from the list of available methods

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