querycounter role, test for that and a new schema hierarchy for additional Moose...
[dbsrgits/DBIx-Class.git] / t / lib / DBICNGTest / Schema / Result / FriendList.pm
CommitLineData
62fa8aec 1package #hide from pause
2 DBICNGTest::Schema::Result::FriendList;
3
4 use Moose;
5 extends 'DBICNGTest::Schema::Result';
6
7
8=head1 NAME
9
10Zoomwit::tlib::DBIC::Schema::Result::FriendList; An example Friends Class;
11
12=head1 VERSION
13
140.01
15
16=cut
17
18our $VERSION = '0.01';
19
20
21=head1 DESCRIPTION
22
23A Person can have zero or more friends
24A Person can't be their own friend
25A Person over 18 can't be friends with Persons under 18 and vis versa.
26A Person can have friendships that are not mutual.
27
28=head1 ATTRIBUTES
29
30This class defines the following attributes.
31
32=head1 PACKAGE METHODS
33
34This module defines the following package methods
35
36=head2 table
37
38Name of the Physical table in the database
39
40=cut
41
42__PACKAGE__
43 ->table('friend_list');
44
45
46=head2 add_columns
47
48Add columns and meta information
49
50=head3 fk_person_id
51
52ID of the person with friends
53
54=head3 fk_friend_id
55
56Who is the friend?
57
58=cut
59
60__PACKAGE__
61 ->add_columns(
62 fk_person_id => {
63 data_type=>'integer',
64 },
65 fk_friend_id => {
66 data_type=>'integer',
67 },
68);
69
70
71=head2 primary_key
72
73Sets the Primary keys for this table
74
75=cut
76
77__PACKAGE__
78 ->set_primary_key(qw/fk_person_id fk_friend_id/);
79
80
81=head2 befriender
82
83The person that 'owns' the friendship (list)
84
85=cut
86
87__PACKAGE__
88 ->belongs_to( befriender => 'DBICNGTest::Schema::Result::Person', {
89 'foreign.person_id' => 'self.fk_person_id' });
90
91
92=head2 friendee
93
94The actual friend that befriender is listing
95
96=cut
97
98__PACKAGE__
99 ->belongs_to( friendee => 'DBICNGTest::Schema::Result::Person', {
100 'foreign.person_id' => 'self.fk_friend_id' });
101
102
103=head1 METHODS
104
105This module defines the following methods.
106
107=head1 AUTHORS
108
109See L<DBIx::Class> for more information regarding authors.
110
111=head1 LICENSE
112
113You may distribute this code under the same terms as Perl itself.
114
115=cut
116
117
1181;