Bug 21160 - C4::Members loads and calls Koha::Schema directly
Summary: C4::Members loads and calls Koha::Schema directly
Status: RESOLVED DUPLICATE of bug 21015
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-06 05:52 UTC by David Cook
Modified: 2018-10-17 18:40 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:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2018-08-06 05:52:35 UTC
I just noticed that C4::Members runs "use Koha::Schema" then calls Koha::Schema->resultset(‘Borrower’) in get_cardnumber_length(). 

Surely that should be calling Koha::Database->schema() and using $schema->resultset(‘Borrower’)? 

It’s the only place this happens in the entire codebase (introduced by https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15690 and then moved by a later commit), so I’m thinking it’s a bug. 

I don’t know that it would have a big impact on anything, but I figure it's worth raising an issue for it anyway.
Comment 1 Jonathan Druart 2018-08-17 14:50:24 UTC
It means the same, but for consistency we could replace it yes.
Comment 2 David Cook 2018-08-20 01:57:38 UTC
(In reply to Jonathan Druart from comment #1)
> It means the same, but for consistency we could replace it yes.

Cool. I'll replace it sometime.

I'd argue that it's not quite the same. The main reason I was noticing it was because "use Koha::Schema" caused the schema to be loaded at compile time whereas using "use Koha::Database" meant it would load the schema at run time for a particular code path. I was getting the schema loaded even when I didn't need it. But that was for CGI. Wouldn't be an issue for Plack.
Comment 3 Jonathan Druart 2018-10-17 18:40:10 UTC

*** This bug has been marked as a duplicate of bug 21015 ***