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

(-)a/Koha/Object.pm (+12 lines)
Lines 207-212 sub id { Link Here
207
    return $id;
207
    return $id;
208
}
208
}
209
209
210
=head3 $object->unblessed();
211
212
Returns an unblessed representation of object.
213
214
=cut
215
216
sub unblessed {
217
    my ($self) = @_;
218
219
    return { $self->_result->get_columns };
220
}
221
210
=head3 $object->_result();
222
=head3 $object->_result();
211
223
212
Returns the internal DBIC Row object
224
Returns the internal DBIC Row object
(-)a/Koha/Objects.pm (+12 lines)
Lines 181-186 sub as_list { Link Here
181
    return wantarray ? @objects : \@objects;
181
    return wantarray ? @objects : \@objects;
182
}
182
}
183
183
184
=head3 Koha::Objects->unblessed
185
186
Returns an unblessed representation of objects.
187
188
=cut
189
190
sub unblessed {
191
    my ($self) = @_;
192
193
    return [ map { $_->unblessed } $self->as_list ];
194
}
195
184
=head3 Koha::Objects->_wrap
196
=head3 Koha::Objects->_wrap
185
197
186
wraps the DBIC object in a corresponding Koha object
198
wraps the DBIC object in a corresponding Koha object
(-)a/Koha/REST/V1/Borrowers.pm (-6 / +5 lines)
Lines 4-26 use Modern::Perl; Link Here
4
4
5
use Mojo::Base 'Mojolicious::Controller';
5
use Mojo::Base 'Mojolicious::Controller';
6
6
7
use C4::Members;
7
use Koha::Borrowers;
8
8
9
sub list_borrowers {
9
sub list_borrowers {
10
    my ($c, $args, $cb) = @_;
10
    my ($c, $args, $cb) = @_;
11
11
12
    my $borrowers = C4::Members::Search;
12
    my $borrowers = Koha::Borrowers->search;
13
13
14
    $c->$cb($borrowers, 200);
14
    $c->$cb($borrowers->unblessed, 200);
15
}
15
}
16
16
17
sub get_borrower {
17
sub get_borrower {
18
    my ($c, $args, $cb) = @_;
18
    my ($c, $args, $cb) = @_;
19
19
20
    my $borrower = C4::Members::GetMemberDetails($args->{borrowernumber});
20
    my $borrower = Koha::Borrowers->find($args->{borrowernumber});
21
21
22
    if ($borrower) {
22
    if ($borrower) {
23
        return $c->$cb($borrower, 200);
23
        return $c->$cb($borrower->unblessed, 200);
24
    }
24
    }
25
25
26
    $c->$cb({error => "Borrower not found"}, 404);
26
    $c->$cb({error => "Borrower not found"}, 404);
27
- 

Return to bug 13799