<div dir="ltr">As discussed in #koha, I think we are not using DBIC as well as we could. Right now we are only using it to replace hand written SQL queries. I would propose the following:<div><br></div><div>1) Allow find and simple searches in pl.</div><div>2) If a search is used more than once, it should be a ResultSet method</div><div><div>3) If a subroutine operates on a single table row, it should be a Result method</div><div></div></div><div>4) If a subroutine operates on a single table, it should be a ResultSet method</div><div>5) Any operation that works on tables linked by key constraints should take advantage of those DBIC relationships and also</div><div><br></div><div>In this way we can do things like:</div><div>$borrower->is_debarred</div><div>or</div><div>$borrower->has_overdues</div><div>orĀ </div><div>@borrowers = $borrower->guarantees()</div><div><br></div><div>Any search can be a method in the ResultSet such as</div><div>$borrower->issue()->overdue_issues();</div><div>or</div><div>my @records_with_holds = $schema->resultset('Biblio')->with_holds()</div><div><br></div><div>I think in the long run this will make or code far more readable, testable, and efficient.</div><div><br></div><div>What do you think?</div><div><br></div><div>Kyle</div><div><br></div><div><a href="http://www.kylehall.info" target="_blank">http://www.kylehall.info</a><br></div><div><div>ByWater Solutions ( <a href="http://bywatersolutions.com" target="_blank">http://bywatersolutions.com</a> )<br>Meadville Public Library ( <a href="http://www.meadvillelibrary.org" target="_blank">http://www.meadvillelibrary.org</a> )<br>Crawford County Federated Library System ( <a href="http://www.ccfls.org" target="_blank">http://www.ccfls.org</a> )<br>Mill Run Technology Solutions ( <a href="http://millruntech.com" target="_blank">http://millruntech.com</a> )<br></div>
</div></div>