| 1 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Interchange6::Schema::Result::ProductAttribute; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Interchange6::Schema::Result::ProductAttribute | ||
| 8 | |||
| 9 | =cut | ||
| 10 | |||
| 11 | 2 | ▶ | use Interchange6::Schema::Candy; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | =head1 ACCESSORS | ||
| 14 | |||
| 15 | =head2 product_attributes_id | ||
| 16 | |||
| 17 | Primary key. | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | 2 | 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 | 2 | 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 | 2 | 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 | 2 | 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 | 2 | 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 | 2 | 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 | 2 | 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 | 2 | has_many | |
| 106 | product_attribute_values => | ||
| 107 | "Interchange6::Schema::Result::ProductAttributeValue", | ||
| 108 | "product_attributes_id", | ||
| 109 | { cascade_copy => 0, cascade_delete => 0 }; | ||
| 110 | |||
| 111 | 2 | 1; | |