Bug 24857: Add object classes to Schema
[koha.git] / Koha / Schema / Result / ItemGroup.pm
1 use utf8;
2 package Koha::Schema::Result::ItemGroup;
3
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7 =head1 NAME
8
9 Koha::Schema::Result::ItemGroup
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<item_groups>
19
20 =cut
21
22 __PACKAGE__->table("item_groups");
23
24 =head1 ACCESSORS
25
26 =head2 item_group_id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 id for the items group
33
34 =head2 biblio_id
35
36   data_type: 'integer'
37   default_value: 0
38   is_foreign_key: 1
39   is_nullable: 0
40
41 id for the bibliographic record the group belongs to
42
43 =head2 display_order
44
45   data_type: 'integer'
46   default_value: 0
47   is_nullable: 0
48
49 The 'sort order' for item_groups
50
51 =head2 description
52
53   data_type: 'mediumtext'
54   is_nullable: 1
55
56 A group description
57
58 =head2 created_on
59
60   data_type: 'timestamp'
61   datetime_undef_if_invalid: 1
62   is_nullable: 1
63
64 Time and date the group was created
65
66 =head2 updated_on
67
68   data_type: 'timestamp'
69   datetime_undef_if_invalid: 1
70   default_value: current_timestamp
71   is_nullable: 0
72
73 Time and date of the latest change on the group
74
75 =cut
76
77 __PACKAGE__->add_columns(
78   "item_group_id",
79   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
80   "biblio_id",
81   {
82     data_type      => "integer",
83     default_value  => 0,
84     is_foreign_key => 1,
85     is_nullable    => 0,
86   },
87   "display_order",
88   { data_type => "integer", default_value => 0, is_nullable => 0 },
89   "description",
90   { data_type => "mediumtext", is_nullable => 1 },
91   "created_on",
92   {
93     data_type => "timestamp",
94     datetime_undef_if_invalid => 1,
95     is_nullable => 1,
96   },
97   "updated_on",
98   {
99     data_type => "timestamp",
100     datetime_undef_if_invalid => 1,
101     default_value => \"current_timestamp",
102     is_nullable => 0,
103   },
104 );
105
106 =head1 PRIMARY KEY
107
108 =over 4
109
110 =item * L</item_group_id>
111
112 =back
113
114 =cut
115
116 __PACKAGE__->set_primary_key("item_group_id");
117
118 =head1 RELATIONS
119
120 =head2 biblio
121
122 Type: belongs_to
123
124 Related object: L<Koha::Schema::Result::Biblio>
125
126 =cut
127
128 __PACKAGE__->belongs_to(
129   "biblio",
130   "Koha::Schema::Result::Biblio",
131   { biblionumber => "biblio_id" },
132   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
133 );
134
135 =head2 item_group_items
136
137 Type: has_many
138
139 Related object: L<Koha::Schema::Result::ItemGroupItem>
140
141 =cut
142
143 __PACKAGE__->has_many(
144   "item_group_items",
145   "Koha::Schema::Result::ItemGroupItem",
146   { "foreign.item_group_id" => "self.item_group_id" },
147   { cascade_copy => 0, cascade_delete => 0 },
148 );
149
150
151 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-02 16:18:20
152 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YO7VdfzHDqBjGHt7vQX7gw
153
154 sub koha_objects_class {
155     'Koha::Biblio::ItemGroups';
156 }
157 sub koha_object_class {
158     'Koha::Biblio::ItemGroup';
159 }
160
161 1;