Bug 32336: (QA follow-up) Use $metadata->schema
[srvgit] / Koha / Ticket / Update.pm
1 package Koha::Ticket::Update;
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18 use Modern::Perl;
19
20 use base qw(Koha::Object);
21
22 =head1 NAME
23
24 Koha::Ticket::Update - Koha Ticket Update Object class
25
26 =head1 API
27
28 =head2 Relations
29
30 =cut
31
32 =head3 ticket
33
34 Return the ticket this update relates to
35
36 =cut
37
38 sub ticket {
39     my ($self) = @_;
40     my $rs = $self->_result->ticket;
41     return unless $rs;
42     return Koha::Ticket->_new_from_dbic($rs);
43 }
44
45 =head3 user
46
47 Return the patron who submitted this update
48
49 =cut
50
51 sub user {
52     my ($self) = @_;
53     my $rs = $self->_result->user;
54     return unless $rs;
55     return Koha::Patron->_new_from_dbic($rs);
56 }
57
58 =head2 Internal methods
59
60 =head3 to_api_mapping
61
62 This method returns the mapping for representing a Koha::Ticket::Update object
63 on the API.
64
65 =cut
66
67 sub to_api_mapping {
68     return { id => 'update_id', };
69 }
70
71 =head3 _type
72
73 =cut
74
75 sub _type {
76     return 'TicketUpdate';
77 }
78
79 1;