[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
Wed Apr 10 16:40:11 CEST 2019


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

--- Comment #7 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
DRAFT:

Within PERL15 under Koha::Object

Koha::Object relationship accessors should be written to allow 'prefetch'

For example one should use:

sub guarantor {
    my $self = shift;
    my $guarantor_rs = $self->_result->guarantorid;
    return unless $guarantor_rs;
    return Koha::Patron->_new_from_dbic($gaurantor_rs);
}

One should not use:

sub guarantor {
    my $self = shift;
    return Koha::Patrons->find( $self->guarantorid() );
}

-- 
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