line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1319
|
use utf8; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
16
|
|
2
|
|
|
|
|
|
|
package Interchange6::Schema::Result::Attribute; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Interchange6::Schema::Result::Attribute |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=cut |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
93
|
use Interchange6::Schema::Candy; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
14
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 ACCESSORS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head2 attributes_id |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Primary key. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
primary_column attributes_id => { |
21
|
|
|
|
|
|
|
data_type => "integer", |
22
|
|
|
|
|
|
|
is_auto_increment => 1, |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 name |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Attribute name, e.g. color or size. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Required. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
column name => { |
34
|
|
|
|
|
|
|
data_type => "varchar", |
35
|
|
|
|
|
|
|
size => 255, |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 type |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Attribute type, e.g. variant. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Defaults to empty string. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
column type => { |
47
|
|
|
|
|
|
|
data_type => "varchar", |
48
|
|
|
|
|
|
|
default_value => "", |
49
|
|
|
|
|
|
|
size => 255, |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 title |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Displayed title for attribute name, e.g. Color or Size. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Defaults to same value as L</name> via L</new> method. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
column title => { |
61
|
|
|
|
|
|
|
data_type => "varchar", |
62
|
|
|
|
|
|
|
size => 255, |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 dynamic |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Boolean flag to designate the attribute as being dynamic. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Defaults to false. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
column dynamic => { |
74
|
|
|
|
|
|
|
data_type => "boolean", |
75
|
|
|
|
|
|
|
default_value => 0, |
76
|
|
|
|
|
|
|
}; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 priority |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Display order priority. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Defaults to 0. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
column priority => { |
87
|
|
|
|
|
|
|
data_type => "integer", |
88
|
|
|
|
|
|
|
default_value => 0, |
89
|
|
|
|
|
|
|
}; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 UNIQUE CONSTRAINT |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 attributes_name_type |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over 4 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * L</name> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * L</type> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=back |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
unique_constraint attributes_name_type => [qw/name type/]; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 RELATIONS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 attribute_values |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Type: has_many |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::AttributeValue> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
has_many |
118
|
|
|
|
|
|
|
attribute_values => "Interchange6::Schema::Result::AttributeValue", |
119
|
|
|
|
|
|
|
{ "foreign.attributes_id" => "self.attributes_id" }, |
120
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 product_attributes |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Type: has_many |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::ProductAttribute> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
has_many |
131
|
|
|
|
|
|
|
product_attributes => "Interchange6::Schema::Result::ProductAttribute", |
132
|
|
|
|
|
|
|
{ "foreign.attributes_id" => "self.attributes_id" }, |
133
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }; |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 navigation_attributes |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Type: has_many |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Related object: L<Interchange6::Schema::Result::NavigationAttribute> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
has_many |
144
|
|
|
|
|
|
|
navigation_attributes => "Interchange6::Schema::Result::NavigationAttribute", |
145
|
|
|
|
|
|
|
{ "foreign.attributes_id" => "self.attributes_id" }, |
146
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 METHODS |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 new |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Set default value of L</title> to L</name>. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub new { |
157
|
58
|
|
|
58
|
1
|
123864
|
my ( $class, $attrs ) = @_; |
158
|
|
|
|
|
|
|
|
159
|
58
|
100
|
|
|
|
290
|
$attrs->{title} = $attrs->{name} unless defined $attrs->{title}; |
160
|
|
|
|
|
|
|
|
161
|
58
|
|
|
|
|
281
|
my $new = $class->next::method($attrs); |
162
|
|
|
|
|
|
|
|
163
|
58
|
|
|
|
|
49334
|
return $new; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |