[Koha-bugs] [Bug 13019] Add base classes on which to build Koha objects

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 21 18:27:36 CET 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13019

--- Comment #27 from Kyle M Hall <kyle at bywatersolutions.com> ---
(In reply to M. de Rooy from comment #26)
> (In reply to Jonathan Druart from comment #25)
> Please be assured that I appreciate your work and eagerness to get things
> into Koha. I also know that it can be somewhat frustrating to see things
> develop rather slow. Since this is meant to be a very fundamental object, I
> would not recommend hurry here btw.

I assure you, we haven't hurried ; ) This has taken months of discussion and
proofs of concept so far!

> > Yes of course. We will only add methods in Koha::Object[s] if needed and
> > make sense.
> This sounds like a misunderstanding. If it would be so obvious to not have
> DBIx code in a perl script (or unit test!), why does Borrower.t contain
> constructs like: 
> my $borrower = Koha::Database->new()->schema()->resultset('Borrower')->find(
> $borrowernumber );

It's just a way to test that our objects are actually making changes to the
database. We don't want to test our objects by using our objects!

> Just replace it by something like Koha::Borrower->find( $borrowernumber ) or
> even extend new with similar functionality, as commented before. This would
> make new_from_dbic as external method (!! -- could be private though with an
> underscore) and passing resultsets superfluous. Leave the result set stuff
> in the objects.

new_from_dbic will probably never be used in actual Koha code, but it needs to
be external for the objects to use. You should never see new_from_dbic used in
a pl file.

> 
> Also note that Koha::Borrowers->new()->find is not really elegant. Why not
> offer both Koha::Borrower->find and Koha::Borrowers->find without going
> through new?

Right now those methods are not static. That's an improvement we can work on
over time! It's at least more elegant than
Koha::Database->new()->schema()->resultset('Borrower')->find( $borrowernumber
); don't you think? ; )

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list