[Koha-bugs] [Bug 25044] No need to define koha_object[s]_class for standard object class names

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sun Apr 12 21:28:47 CEST 2020


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

Katrin Fischer <katrin.fischer at bsz-bw.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #102529|0                           |1
        is obsolete|                            |

--- Comment #5 from Katrin Fischer <katrin.fischer at bsz-bw.de> ---
Created attachment 102774
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102774&action=edit
Bug 25044: Remove the need to define koha_object[s]_class for standard object
class names

In Koha::Object[s]->prefetch_whitelist, there is a call to the
koha_object[s]_class DBIC resultset class. We should not, otherwise those 2
methods will have to be defined all the time, even when we can guess it easily.

Koha::Item <> Schema::Result::Item => standard
Koha::Acquisition::Order <> Schema::Result::Aqorder => non-standard

sub _get_object_class {
    my ( $type ) = @_;
    return unless $type;

    if( $type->can('koha_object_class') ) {
        return $type->koha_object_class;
    }
    $type =~ s|Schema::Result::||;
    return ${type};
}

Test plan:
 % prove t/db_dependent/Koha/Object.t t/db_dependent/Koha/Objects.t
should return green before and after this patch

Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83 at web.de>

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


More information about the Koha-bugs mailing list