Bug 20566 - Remove 'single' method from Koha::Objects
Summary: Remove 'single' method from Koha::Objects
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Database (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-11 15:38 UTC by Martin Renvoize
Modified: 2018-12-03 20:03 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2018-04-11 15:38:32 UTC
We're exposing ourselves to terrible bugs which dbix::class goes to lengths to inform the developer about before they're added by circumventing the protections built into dbic here.

By hard coding a 'rows => 1' into this method instead of just using the method from DBIC we are ensuring the developer will never be informed of their stupidity if they have not added any form or ordering to their database clauses. As such, the order of the results returned and as such the result of the 'single' call is now entirely random.
Comment 1 Jonathan Druart 2018-04-11 15:40:44 UTC
Hum?

188 sub single {
189     my ($self) = @_;
190 
191     my $single = $self->_resultset()->single;
192     return unless $single;
193 
194     return $self->object_class()->_new_from_dbic($single);
195 }