[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:46:52 CET 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #1 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
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.

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


More information about the Koha-bugs mailing list