@@ -, +, @@ standard object class names my ( $type ) = @_; return unless $type; if( $type->can('koha_object_class') ) { return $type->koha_object_class; } $type =~ s|Schema::Result::||; return ${type}; % prove t/db_dependent/Koha/Object.t t/db_dependent/Koha/Objects.t --- Koha/Object.pm | 2 +- t/db_dependent/Koha/Object.t | 10 ++++++++-- t/db_dependent/Koha/Objects.t | 10 ++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) --- a/Koha/Object.pm +++ a/Koha/Object.pm @@ -436,7 +436,7 @@ sub prefetch_whitelist { my $result_class = $relations->{$key}->{class}; my $obj = $result_class->new; try { - $whitelist->{$key} = $obj->koha_object_class; + $whitelist->{$key} = Koha::Object::_get_object_class( $obj->result_class ); } catch { $whitelist->{$key} = undef; } --- a/t/db_dependent/Koha/Object.t +++ a/t/db_dependent/Koha/Object.t @@ -796,7 +796,7 @@ subtest 'get_from_storage' => sub { subtest 'prefetch_whitelist() tests' => sub { - plan tests => 2; + plan tests => 3; $schema->storage->txn_begin; @@ -811,7 +811,13 @@ subtest 'prefetch_whitelist() tests' => sub { is( $prefetch_whitelist->{orders}, 'Koha::Acquisition::Order', - 'Guessed the object class correctly' + 'Guessed the non-standard object class correctly' + ); + + is( + $prefetch_whitelist->{items}, + 'Koha::Item', + 'Guessed the standard object class correctly' ); $schema->storage->txn_rollback; --- a/t/db_dependent/Koha/Objects.t +++ a/t/db_dependent/Koha/Objects.t @@ -773,7 +773,7 @@ subtest "from_api_mapping() tests" => sub { subtest 'prefetch_whitelist() tests' => sub { - plan tests => 2; + plan tests => 3; $schema->storage->txn_begin; @@ -788,7 +788,13 @@ subtest 'prefetch_whitelist() tests' => sub { is( $prefetch_whitelist->{orders}, 'Koha::Acquisition::Order', - 'Guessed the object class correctly' + 'Guessed the non-standard object class correctly' + ); + + is( + $prefetch_whitelist->{items}, + 'Koha::Item', + 'Guessed the standard object class correctly' ); $schema->storage->txn_rollback; --