File Coverage

blib/lib/Interchange6/Schema/Result/ProductAttribute.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1 2     2   1144 use utf8;
  2         5  
  2         15  
2              
3             package Interchange6::Schema::Result::ProductAttribute;
4              
5             =head1 NAME
6              
7             Interchange6::Schema::Result::ProductAttribute
8              
9             =cut
10              
11 2     2   91 use Interchange6::Schema::Candy;
  2         6  
  2         13  
12              
13             =head1 ACCESSORS
14              
15             =head2 product_attributes_id
16              
17             Primary key.
18              
19             =cut
20              
21             primary_column product_attributes_id =>
22             { data_type => "integer", is_auto_increment => 1 };
23              
24             =head2 sku
25              
26             FK on L<Interchange6::Schema::Result::Product/sku>.
27              
28             =cut
29              
30             column sku =>
31             { data_type => "varchar", size => 64 };
32              
33             =head2 attributes_id
34              
35             FK on L<Interchange6::Schema::Result::Attribute/attributes_id>.
36              
37             =cut
38              
39             column attributes_id =>
40             { data_type => "integer" };
41              
42             =head2 canonical
43              
44             Determines whether this attribute requires his own product.
45              
46             Defaults to 1 (true).
47              
48             =cut
49              
50             column canonical =>
51             { data_type => "boolean", default_value => 1 };
52              
53             =head1 UNIQUE CONSTRAINT
54              
55             =head2 sku_attributes_id
56              
57             =over 4
58              
59             =item * L</sku>
60              
61             =item * L</attributes_id>
62              
63             =back
64              
65             =cut
66              
67             unique_constraint sku_attributes_id => [qw/sku attributes_id/];
68              
69             =head1 RELATIONS
70              
71             =head2 product
72              
73             Type: belongs_to
74              
75             Related object: L<Interchange6::Schema::Result::Product>
76              
77             =cut
78              
79             belongs_to
80             product => "Interchange6::Schema::Result::Product",
81             "sku",
82             { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" };
83              
84             =head2 attribute
85              
86             Type: belongs_to
87              
88             Related object: L<Interchange6::Schema::Result::Attribute>
89              
90             =cut
91              
92             belongs_to
93             attribute => "Interchange6::Schema::Result::Attribute",
94             "attributes_id",
95             { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" };
96              
97             =head2 product_attribute_values
98              
99             Type: has_many
100              
101             Related object: L<Interchange6::Schema::Result::ProductAttributeValue>
102              
103             =cut
104              
105             has_many
106             product_attribute_values =>
107             "Interchange6::Schema::Result::ProductAttributeValue",
108             "product_attributes_id",
109             { cascade_copy => 0, cascade_delete => 0 };
110              
111             1;