fixed View's doc | added me to contributors list
[dbsrgits/DBIx-Class.git] / t / lib / DBICNGTest / Schema / Result / Gender.pm
CommitLineData
62fa8aec 1package #hide from pause
2 DBICNGTest::Schema::Result::Gender;
3
4 use Moose;
5 extends 'DBICNGTest::Schema::Result';
6
7
8=head1 NAME
9
10DBICNGTest::Schema::Result::Gender; An example Gender Class;
11
12=head1 DESCRIPTION
13
14Tests for this type of FK relationship
15
16=head1 ATTRIBUTES
17
18This class defines the following attributes.
19
20=head2 label
21
22example of using an attribute to add constraints on a table insert
23
24=cut
25
26has 'label' =>(is=>'rw', required=>1, isa=>'Str');
27
28
29=head1 PACKAGE METHODS
30
31This module defines the following package methods
32
33=head2 table
34
35Name of the Physical table in the database
36
37=cut
38
39__PACKAGE__
40 ->table('gender');
41
42
43=head2 add_columns
44
45Add columns and meta information
46
47=head3 gender_id
48
49Primary Key which is an auto generated UUID
50
51=head3 label
52
53Text label of the gender (ie, 'male', 'female', 'transgender', etc.).
54
55=cut
56
57__PACKAGE__
58 ->add_columns(
59 gender_id => {
60 data_type=>'integer',
61 },
62 label => {
63 data_type=>'varchar',
64 size=>12,
65 },
66 );
67
68
69=head2 primary_key
70
71Sets the Primary keys for this table
72
73=cut
74
75__PACKAGE__
76 ->set_primary_key(qw/gender_id/);
77
78
79=head2
80
81Marks the unique columns
82
83=cut
84
85__PACKAGE__
86 ->add_unique_constraint('gender_label_unique' => [ qw/label/ ]);
87
88
89=head2 people
90
91A resultset of people with this gender
92
93=cut
94
95__PACKAGE__
96 ->has_many(
97 people => 'DBICNGTest::Schema::Result::Person',
98 {'foreign.fk_gender_id' => 'self.gender_id'}
99 );
100
101
102=head1 METHODS
103
104This module defines the following methods.
105
106=head1 AUTHORS
107
108See L<DBIx::Class> for more information regarding authors.
109
110=head1 LICENSE
111
112You may distribute this code under the same terms as Perl itself.
113
114=cut
115
116
1171;