View | Details | Raw Unified | Return to bug 25044
Collapse All | Expand All

(-)a/Koha/Object.pm (-1 / +1 lines)
Lines 436-442 sub prefetch_whitelist { Link Here
436
            my $result_class = $relations->{$key}->{class};
436
            my $result_class = $relations->{$key}->{class};
437
            my $obj = $result_class->new;
437
            my $obj = $result_class->new;
438
            try {
438
            try {
439
                $whitelist->{$key} = $obj->koha_object_class;
439
                $whitelist->{$key} = Koha::Object::_get_object_class( $obj->result_class );
440
            } catch {
440
            } catch {
441
                $whitelist->{$key} = undef;
441
                $whitelist->{$key} = undef;
442
            }
442
            }
(-)a/Koha/Objects.pm (-1 / +1 lines)
Lines 362-368 Returns a hash of prefetchable subs and the type it returns Link Here
362
sub prefetch_whitelist {
362
sub prefetch_whitelist {
363
    my ( $self ) = @_;
363
    my ( $self ) = @_;
364
364
365
    $self->{_singular_object} ||= $self->object_class->new();
365
    $self->{_singular_object} ||= $self->_get_object_class->new();
366
366
367
    $self->{_singular_object}->prefetch_whitelist;
367
    $self->{_singular_object}->prefetch_whitelist;
368
}
368
}
(-)a/t/db_dependent/Koha/Object.t (-2 / +8 lines)
Lines 796-802 subtest 'get_from_storage' => sub { Link Here
796
796
797
subtest 'prefetch_whitelist() tests' => sub {
797
subtest 'prefetch_whitelist() tests' => sub {
798
798
799
    plan tests => 2;
799
    plan tests => 3;
800
800
801
    $schema->storage->txn_begin;
801
    $schema->storage->txn_begin;
802
802
Lines 811-817 subtest 'prefetch_whitelist() tests' => sub { Link Here
811
    is(
811
    is(
812
        $prefetch_whitelist->{orders},
812
        $prefetch_whitelist->{orders},
813
        'Koha::Acquisition::Order',
813
        'Koha::Acquisition::Order',
814
        'Guessed the object class correctly'
814
        'Guessed the non-standard object class correctly'
815
    );
816
817
    is(
818
        $prefetch_whitelist->{items},
819
        'Koha::Item',
820
        'Guessed the standard object class correctly'
815
    );
821
    );
816
822
817
    $schema->storage->txn_rollback;
823
    $schema->storage->txn_rollback;
(-)a/t/db_dependent/Koha/Objects.t (-3 / +8 lines)
Lines 773-779 subtest "from_api_mapping() tests" => sub { Link Here
773
773
774
subtest 'prefetch_whitelist() tests' => sub {
774
subtest 'prefetch_whitelist() tests' => sub {
775
775
776
    plan tests => 2;
776
    plan tests => 3;
777
777
778
    $schema->storage->txn_begin;
778
    $schema->storage->txn_begin;
779
779
Lines 788-794 subtest 'prefetch_whitelist() tests' => sub { Link Here
788
    is(
788
    is(
789
        $prefetch_whitelist->{orders},
789
        $prefetch_whitelist->{orders},
790
        'Koha::Acquisition::Order',
790
        'Koha::Acquisition::Order',
791
        'Guessed the object class correctly'
791
        'Guessed the non-standard object class correctly'
792
    );
793
794
    is(
795
        $prefetch_whitelist->{items},
796
        'Koha::Item',
797
        'Guessed the standard object class correctly'
792
    );
798
    );
793
799
794
    $schema->storage->txn_rollback;
800
    $schema->storage->txn_rollback;
795
- 

Return to bug 25044