[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Feb 26 18:51:22 CET 2019
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407
--- Comment #2 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
(In reply to Jonathan Druart from comment #1)
> Yes, and no.
>
> You can only do that if you know the patron has a guarantor, which is not
> always true.
>
> You must do:
> sub guarantor {
> my ( $self ) = @_;
> my $guarantor_rs = $self->_result->guarantorid;
> return unless $guarantor_rs;
> return Koha::Patron->_new_from_dbic($guarantor_rs);
> }
>
> I am definitely in favor of that, we should have a guideline about it IMO.
The pattern should cover the one-to-many use case as well. And yes, the idea is
to propose a coding guideline!
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list