[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
Wed Oct 1 19:20:22 CEST 2014


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

--- Comment #3 from Kyle M Hall <kyle at bywatersolutions.com> ---
> 1/ Type and ObjectClass could be attributes, instead of methods

Could write a followup? I tried to do that but had issues with getting the base
class to know about the package variable. I was properly implementing it wrong.

> 2/ I really would like to see method name without capital letters (and
> underscore '_' to separate words)

I have no strong preference here as long as we stick to one convention. My only
concern would be a convention conflict where a table has the same name as a
field in the table. That would lead to ambiguity, but I'm not sure if we even
have an instance of this. For example, let's say a table has the field borrower
which is actually a borrowernumber. I'd like to have $row->borrower return the
borrowernumber, but $row->Borrower return the Koha::Borrower object. That way
we know when we are getting back a scalar, and when we are getting back an
Object. It would be silly to fetch the Koha::Borrower in a case where we just
need the borrowernumber, which we would already have.

> 3/ "Bad setter returns undef" => not sure about that. Bad setter should croak

Agreed.

> 4/ What about using Class::Accessor?

I don't see the advantage to this. Can you give an example. This implementation
uses a DBIC object as a place to store the data, so there is no need to have
separate properties. Please note the this should not conflict this unit testing
on a database-less system. t/Object.t should demonstrate this.

> 5/ t/db_dependent/Objects.t should be t/db_dependent/Borrowers.t

I can see your point, but the tests are really testing the base classes, and
not the Borrower classes per se. However, I have no strong opinion so that's
fine by me.

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


More information about the Koha-bugs mailing list