| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
2194
|
use utf8; |
|
|
2
|
|
|
|
|
19
|
|
|
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Interchange6::Schema::Result::Message; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Interchange6::Schema::Result::Message |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
|
10
|
|
|
|
|
|
|
|
|
11
|
2
|
|
|
|
|
18
|
use Interchange6::Schema::Candy -components => |
|
12
|
2
|
|
|
2
|
|
115
|
[qw(Tree::AdjacencyList InflateColumn::DateTime TimeStamp)]; |
|
|
2
|
|
|
|
|
4
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
7122
|
use Moo; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Shared messages table for blog, order comments, reviews, bb, etc. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 type |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
A short-cut accessor which takes a message type name (L<Interchange6::Schema::Result::MessageType/name>) as argument and sets L</message_types_id> to the appropriate value; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has type => ( is => 'rw', ); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 messages_id |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Primary key. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
primary_column messages_id => { |
|
37
|
|
|
|
|
|
|
data_type => "integer", |
|
38
|
|
|
|
|
|
|
is_auto_increment => 1, |
|
39
|
|
|
|
|
|
|
}; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 title |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The title of the message. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
column title => { |
|
48
|
|
|
|
|
|
|
data_type => "varchar", |
|
49
|
|
|
|
|
|
|
default_value => "", |
|
50
|
|
|
|
|
|
|
size => 255 |
|
51
|
|
|
|
|
|
|
}; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 message_types_id |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Foreign key constraint on L<Interchange6::Schema::Result::MessageType/message_types_id> |
|
56
|
|
|
|
|
|
|
via L</message_type> relationship. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
column message_types_id => { |
|
61
|
|
|
|
|
|
|
data_type => "integer", |
|
62
|
|
|
|
|
|
|
}; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 uri |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The uri of the message data. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Unique constraint. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
unique_column uri => { |
|
73
|
|
|
|
|
|
|
data_type => "varchar", |
|
74
|
|
|
|
|
|
|
is_nullable => 1, |
|
75
|
|
|
|
|
|
|
size => 255 |
|
76
|
|
|
|
|
|
|
}; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 format |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
The format of the text held in L</content>, e.g. plain, html or markdown. |
|
81
|
|
|
|
|
|
|
Defaults to 'plain'. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
column format => { |
|
86
|
|
|
|
|
|
|
data_type => "varchar", |
|
87
|
|
|
|
|
|
|
size => 32, |
|
88
|
|
|
|
|
|
|
default_value => "plain", |
|
89
|
|
|
|
|
|
|
}; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 content |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Content for the message. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
column content => { |
|
98
|
|
|
|
|
|
|
data_type => "text" |
|
99
|
|
|
|
|
|
|
}; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 summary |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Summary/teaser for L</content>. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Defaults to empty string. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
column summary => { |
|
110
|
|
|
|
|
|
|
data_type => "varchar", |
|
111
|
|
|
|
|
|
|
size => 1024, |
|
112
|
|
|
|
|
|
|
default_value => '', |
|
113
|
|
|
|
|
|
|
}; |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 author_users_id |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Foreign key constraint on L<Interchange6::Schema::Result::User/users_id> |
|
118
|
|
|
|
|
|
|
via L</author> relationship. Is nullable. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
column author_users_id => { |
|
123
|
|
|
|
|
|
|
data_type => "integer", |
|
124
|
|
|
|
|
|
|
is_nullable => 1 |
|
125
|
|
|
|
|
|
|
}; |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 rating |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Numeric rating of the message by a user. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
column rating => { |
|
134
|
|
|
|
|
|
|
data_type => "numeric", |
|
135
|
|
|
|
|
|
|
default_value => 0, |
|
136
|
|
|
|
|
|
|
size => [ 4, 2 ], |
|
137
|
|
|
|
|
|
|
}; |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 recommend |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Do you recommend the message? Default is no. Is nullable. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
column recommend => { |
|
146
|
|
|
|
|
|
|
data_type => "boolean", |
|
147
|
|
|
|
|
|
|
is_nullable => 1 |
|
148
|
|
|
|
|
|
|
}; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 public |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Is this public viewable? Default is no. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
column public => { |
|
157
|
|
|
|
|
|
|
data_type => "boolean", |
|
158
|
|
|
|
|
|
|
default_value => 0, |
|
159
|
|
|
|
|
|
|
}; |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 approved |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Has this been approved by someone with proper rights? |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
column approved => { |
|
168
|
|
|
|
|
|
|
data_type => "boolean", |
|
169
|
|
|
|
|
|
|
default_value => 0, |
|
170
|
|
|
|
|
|
|
}; |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 approved_by_users_id |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Foreign key constraint on L<Interchange6::Schema::Result::User/users_id> |
|
175
|
|
|
|
|
|
|
via L</approved_by> relationship. Is nullable |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
column approved_by_users_id => { |
|
180
|
|
|
|
|
|
|
data_type => "integer", |
|
181
|
|
|
|
|
|
|
is_nullable => 1 |
|
182
|
|
|
|
|
|
|
}; |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 parent_id |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
For use by L<DBIx::Class::Tree::AdjacencyList> this defines the L</messages_id> |
|
187
|
|
|
|
|
|
|
of the parent of this message (if any). |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
column parent_id => { data_type => "integer", is_nullable => 1 }; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 created |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Date and time when this record was created returned as L<DateTime> object. |
|
196
|
|
|
|
|
|
|
Value is auto-set on insert. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
column created => { |
|
201
|
|
|
|
|
|
|
data_type => "datetime", |
|
202
|
|
|
|
|
|
|
set_on_create => 1, |
|
203
|
|
|
|
|
|
|
}; |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head2 last_modified |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Date and time when this record was last modified returned as L<DateTime> object. |
|
208
|
|
|
|
|
|
|
Value is auto-set on insert and update. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
column last_modified => { |
|
213
|
|
|
|
|
|
|
data_type => "datetime", |
|
214
|
|
|
|
|
|
|
set_on_create => 1, |
|
215
|
|
|
|
|
|
|
set_on_update => 1, |
|
216
|
|
|
|
|
|
|
}; |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head1 RELATIONS |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head2 author |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Type: belongs_to |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::User> |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
belongs_to |
|
229
|
|
|
|
|
|
|
author => 'Interchange6::Schema::Result::User', |
|
230
|
|
|
|
|
|
|
{ 'foreign.users_id' => 'self.author_users_id' }, |
|
231
|
|
|
|
|
|
|
{ join_type => 'left' }; |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 approved_by |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Type: belongs_to |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::User> |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=cut |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
belongs_to |
|
242
|
|
|
|
|
|
|
approved_by => 'Interchange6::Schema::Result::User', |
|
243
|
|
|
|
|
|
|
{ 'foreign.users_id' => 'self.approved_by_users_id' }, |
|
244
|
|
|
|
|
|
|
{ join_type => 'left' }; |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head2 message_type |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Type: belongs_to |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::MessageType> |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=cut |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
belongs_to |
|
255
|
|
|
|
|
|
|
message_type => 'Interchange6::Schema::Result::MessageType', |
|
256
|
|
|
|
|
|
|
'message_types_id'; |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head2 order_comment |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
Type: might_have |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::OrderComment> |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=cut |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
might_have |
|
267
|
|
|
|
|
|
|
order_comment => 'Interchange6::Schema::Result::OrderComment', |
|
268
|
|
|
|
|
|
|
'messages_id'; |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head2 orders |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Type: many_to_many |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
Accessor to related Order results. |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=cut |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
many_to_many orders => "order_comment", "order"; |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head2 product_messages |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
Type: has_many |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::ProductMessage> |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=cut |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
has_many |
|
289
|
|
|
|
|
|
|
product_messages => 'Interchange6::Schema::Result::ProductMessage', |
|
290
|
|
|
|
|
|
|
'messages_id'; |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head2 products |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Type: many_to_many |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
Accessor to related Product results. |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=cut |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
many_to_many products => "product_messages", "product"; |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=head2 navigation_messages |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
Type: has_many |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::NavigationMessage> |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=cut |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
has_many |
|
311
|
|
|
|
|
|
|
navigation_messages => 'Interchange6::Schema::Result::NavigationMessage', |
|
312
|
|
|
|
|
|
|
'messages_id'; |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=head2 navigations |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
Type: many_to_many |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Accessor to related Navigation results. |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=cut |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
many_to_many navigations => "navigation_messages", "navigation"; |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=head2 media_messages |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Type: has_many |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::MediaMessage> |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=cut |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
has_many |
|
333
|
|
|
|
|
|
|
media_messages => "Interchange6::Schema::Result::MediaMessage", |
|
334
|
|
|
|
|
|
|
"messages_id", |
|
335
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }; |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=head2 media |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
Type: many_to_many with media |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=cut |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
many_to_many media => "media_messages", "media"; |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=head1 INHERITED METHODS |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=head2 DBIx::Class::Tree::AdjacencyList |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=over 4 |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=item * |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
L<parent|DBIx::Class::Tree::AdjacencyList/parent> |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=item * |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
L<ancestors|DBIx::Class::Tree::AdjacencyList/ancestors> |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=item * |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
L<has_descendant|DBIx::Class::Tree::AdjacencyList/has_descendant> |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=item * |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
L<parents|DBIx::Class::Tree::AdjacencyList/parents> |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=item * |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
L<children|DBIx::Class::Tree::AdjacencyList/children> |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=item * |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
L<attach_child|DBIx::Class::Tree::AdjacencyList/attach_child> |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=item * |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
L<siblings|DBIx::Class::Tree::AdjacencyList/siblings> |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=item * |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
L<attach_sibling|DBIx::Class::Tree::AdjacencyList/attach_sibling> |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=item * |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
L<is_leaf|DBIx::Class::Tree::AdjacencyList/is_leaf> |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=item * |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
L<is_root|DBIx::Class::Tree::AdjacencyList/is_root> |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=item * |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
L<is_branch|DBIx::Class::Tree::AdjacencyList/is_branch> |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=back |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=cut |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
# define parent column |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
__PACKAGE__->parent_column('parent_id'); |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=head1 METHODS |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=head2 FOREIGNBUILDARGS |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
Remove L</type> attribute from call to parent class. |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=cut |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
sub FOREIGNBUILDARGS { |
|
412
|
105
|
|
|
105
|
1
|
272799
|
my ( $self, $attrs ) = @_; |
|
413
|
|
|
|
|
|
|
|
|
414
|
105
|
100
|
|
|
|
509
|
if ( defined $attrs->{type} ) { |
|
415
|
102
|
|
|
|
|
266
|
delete $attrs->{type}; |
|
416
|
|
|
|
|
|
|
} |
|
417
|
105
|
|
|
|
|
722
|
return $attrs; |
|
418
|
|
|
|
|
|
|
} |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
=head2 insert |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
Overload insert to set message_types_id if required. Throw exception if requested message type |
|
423
|
|
|
|
|
|
|
is not active. See L<Interchange6::Schema::Result::MessageType/active>. |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
=cut |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
sub insert { |
|
428
|
105
|
|
|
105
|
1
|
29859
|
my $self = shift; |
|
429
|
|
|
|
|
|
|
|
|
430
|
105
|
|
|
|
|
375
|
my $rset_message_type = |
|
431
|
|
|
|
|
|
|
$self->result_source->schema->resultset("MessageType"); |
|
432
|
|
|
|
|
|
|
|
|
433
|
105
|
100
|
|
|
|
39888
|
if ( defined $self->type ) { |
|
434
|
|
|
|
|
|
|
|
|
435
|
102
|
|
|
|
|
310
|
my $name = $self->type; |
|
436
|
|
|
|
|
|
|
|
|
437
|
102
|
100
|
|
|
|
2379
|
if ( defined $self->message_types_id ) { |
|
438
|
3
|
100
|
|
|
|
99
|
$self->throw_exception("mismatched type settings") |
|
439
|
|
|
|
|
|
|
if $name ne $self->message_type->name; |
|
440
|
|
|
|
|
|
|
} |
|
441
|
|
|
|
|
|
|
else { |
|
442
|
|
|
|
|
|
|
|
|
443
|
99
|
|
|
|
|
3652
|
my $rset = $rset_message_type->search( { name => $self->type } ); |
|
444
|
|
|
|
|
|
|
|
|
445
|
99
|
100
|
|
|
|
21865
|
if ( $rset->has_rows ) { |
|
446
|
97
|
|
|
|
|
242430
|
my $result = $rset->next; |
|
447
|
97
|
|
|
|
|
196922
|
$self->set_column( message_types_id => $result->id ); |
|
448
|
|
|
|
|
|
|
} |
|
449
|
|
|
|
|
|
|
else { |
|
450
|
2
|
|
|
|
|
4669
|
$self->throw_exception( |
|
451
|
|
|
|
|
|
|
qq(MessageType with name "$name" does not exist)); |
|
452
|
|
|
|
|
|
|
} |
|
453
|
|
|
|
|
|
|
} |
|
454
|
|
|
|
|
|
|
} |
|
455
|
|
|
|
|
|
|
|
|
456
|
101
|
100
|
|
|
|
34835
|
if ( defined $self->message_types_id ) { |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
# make sure message type is active |
|
459
|
|
|
|
|
|
|
|
|
460
|
99
|
|
|
|
|
16944
|
my $rset = $rset_message_type->search( |
|
461
|
|
|
|
|
|
|
{ message_types_id => $self->message_types_id } ); |
|
462
|
|
|
|
|
|
|
|
|
463
|
99
|
100
|
|
|
|
23468
|
if ( $rset->has_rows ) { |
|
464
|
98
|
|
|
|
|
237961
|
my $result = $rset->next; |
|
465
|
98
|
100
|
|
|
|
203510
|
if ( $result->active ) { |
|
466
|
96
|
|
|
|
|
1870
|
return $self->next::method; |
|
467
|
|
|
|
|
|
|
} |
|
468
|
|
|
|
|
|
|
else { |
|
469
|
2
|
|
|
|
|
101
|
$self->throw_exception( q(MessageType with name ") |
|
470
|
|
|
|
|
|
|
. $result->name |
|
471
|
|
|
|
|
|
|
. q(" is not active) ); |
|
472
|
|
|
|
|
|
|
} |
|
473
|
|
|
|
|
|
|
} |
|
474
|
|
|
|
|
|
|
else { |
|
475
|
1
|
|
|
|
|
2372
|
$self->throw_exception( |
|
476
|
|
|
|
|
|
|
q(message_types_id value does not exist in MessageType)); |
|
477
|
|
|
|
|
|
|
} |
|
478
|
|
|
|
|
|
|
} |
|
479
|
|
|
|
|
|
|
else { |
|
480
|
2
|
|
|
|
|
98
|
$self->throw_exception("Cannot create message without type"); |
|
481
|
|
|
|
|
|
|
} |
|
482
|
|
|
|
|
|
|
} |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
1; |