[Koha-devel] [Koha::Object] Related records and calling methods from templates

Marcel de Rooy M.de.Rooy at rijksmuseum.nl
Thu Sep 15 13:03:26 CEST 2016


Hi devs,

I am seeing more Koha objects that include methods for related records like Koha::Patron, sub image referring to Koha::Patron::Images.
As a second example, on bug 14610 (article requests), a biblio, item, branch and borrower method is added to Koha::ArticleRequest.
Obviously, they all follow the same pattern.
Could we generalize that, and keep our code cleaner?

And do we always need the full Koha object? For use in a template we may need only a few columns.
We start passing these objects to the templates now too, making it possible to call methods from the template. It is possible, but do we really want that? More code ends up in the template, maybe harder to find since you now use borrower.method instead of borrower->method etc. Secondly, reading borrower.something might not immediately tell you that something is a method instead of a column.
In other cases we have added a sort of wrapper like Branches.GetName from the Branches plugin.
I am interested to know if we want to enforce this wrapper approach for instance, or just continue on the current road.

Thx,

Marcel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20160915/4645b4e1/attachment.html>


More information about the Koha-devel mailing list