File Coverage

blib/lib/Interchange6/Schema/Result/Country.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   1174 use utf8;
  2         6  
  2         14  
2              
3             package Interchange6::Schema::Result::Country;
4              
5             =head1 NAME
6              
7             Interchange6::Schema::Result::Country
8              
9             =cut
10              
11 2     2   98 use Interchange6::Schema::Candy;
  2         10  
  2         15  
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             primary_column country_iso_code => { data_type => "char", size => 2 };
30              
31             =head2 scope
32              
33             Internal sorting field.
34              
35             =cut
36              
37             column scope => { data_type => "varchar", default_value => "", size => 32 };
38              
39             =head2 name
40              
41             Full country name.
42              
43             =cut
44              
45             column name => { data_type => "varchar", size => 255 };
46              
47             =head2 priority
48              
49             Display order.
50              
51             =cut
52              
53             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             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             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             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             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             has_many
101             states => "Interchange6::Schema::Result::State",
102             'country_iso_code';
103              
104             1;