| 1 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Interchange6::Schema::Result::Country; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Interchange6::Schema::Result::Country | ||
| 8 | |||
| 9 | =cut | ||
| 10 | |||
| 11 | 2 | ▶ | use Interchange6::Schema::Candy; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | ISO 3166-1 codes for country identification | ||
| 16 | |||
| 17 | =cut | ||
| 18 | |||
| 19 | =head1 ACCESSORS | ||
| 20 | |||
| 21 | =head2 country_iso_code | ||
| 22 | |||
| 23 | Primary key. | ||
| 24 | |||
| 25 | Two letter country code such as 'SI' = Slovenia. | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | 2 | primary_column country_iso_code => { data_type => "char", size => 2 }; | |
| 30 | |||
| 31 | =head2 scope | ||
| 32 | |||
| 33 | Internal sorting field. | ||
| 34 | |||
| 35 | =cut | ||
| 36 | |||
| 37 | 2 | column scope => { data_type => "varchar", default_value => "", size => 32 }; | |
| 38 | |||
| 39 | =head2 name | ||
| 40 | |||
| 41 | Full country name. | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | 2 | column name => { data_type => "varchar", size => 255 }; | |
| 46 | |||
| 47 | =head2 priority | ||
| 48 | |||
| 49 | Display order. | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | 2 | column priority => { data_type => "integer", default_value => 0 }; | |
| 54 | |||
| 55 | =head2 show_states | ||
| 56 | |||
| 57 | Whether this country has related L<Interchange6::Schema::Result::State> via | ||
| 58 | relationship L</states>. Default is false. This is used so that we don't | ||
| 59 | have to bother running a query across the states relation every time we | ||
| 60 | want to check if the country has states (or provinces, etc. ). | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | 2 | column show_states => { data_type => "boolean", default_value => 0 }; | |
| 65 | |||
| 66 | =head2 active | ||
| 67 | |||
| 68 | Active shipping destination? Default is true. | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | 2 | column active => { data_type => "boolean", default_value => 1 }; | |
| 73 | |||
| 74 | =head1 RELATIONSHIPS | ||
| 75 | |||
| 76 | =head2 zone_countries | ||
| 77 | |||
| 78 | C<has_many> relationship with L<Interchange6::Schema::Result::ZoneCountry> | ||
| 79 | |||
| 80 | =cut | ||
| 81 | |||
| 82 | 2 | has_many | |
| 83 | zone_countries => "Interchange6::Schema::Result::ZoneCountry", | ||
| 84 | { "foreign.country_iso_code" => "self.country_iso_code" }; | ||
| 85 | |||
| 86 | =head2 zones | ||
| 87 | |||
| 88 | C<many_to_many> relationship with L<Interchange6::Schema::Result::Zone> | ||
| 89 | |||
| 90 | =cut | ||
| 91 | |||
| 92 | 2 | many_to_many zones => "zone_countries", "zone"; | |
| 93 | |||
| 94 | =head2 states | ||
| 95 | |||
| 96 | C<has_many> relationship with L<Interchange6::Schema::Result::State> | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | 2 | has_many | |
| 101 | states => "Interchange6::Schema::Result::State", | ||
| 102 | 'country_iso_code'; | ||
| 103 | |||
| 104 | 2 | 1; | |