File Coverage

blib/lib/DBIx/Class/Schema/PopulateMore/Test/Schema/Result/FriendList.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package #hide from pause
2             DBIx::Class::Schema::PopulateMore::Test::Schema::Result::FriendList;
3              
4 3     3   2676 use parent 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result';
  3         5  
  3         31  
5              
6             =head1 NAME
7              
8             DBIx::Class::Schema::PopulateMore::Test::Schema::Result::FriendList - An example Friends Class;
9              
10             =head1 DESCRIPTION
11              
12             Probably not the best way to do a friend list relationship.
13              
14             =head1 ATTRIBUTES
15              
16             This class defines the following attributes.
17              
18             =head1 PACKAGE METHODS
19              
20             This module defines the following package methods
21              
22             =head2 table
23              
24             Name of the Physical table in the database
25              
26             =cut
27              
28             __PACKAGE__
29             ->table('friend_list');
30              
31              
32             =head2 add_columns
33              
34             Add columns and meta information
35              
36             =head3 fk_person_id
37              
38             ID of the person with friends
39              
40             =head3 fk_friend_id
41              
42             Who is the friend?
43              
44             =cut
45              
46             __PACKAGE__
47             ->add_columns(
48             fk_person_id => {
49             data_type=>'integer',
50             },
51             fk_friend_id => {
52             data_type=>'integer',
53             },
54             );
55            
56              
57             =head2 primary_key
58              
59             Sets the Primary keys for this table
60              
61             =cut
62              
63             __PACKAGE__
64             ->set_primary_key(qw/fk_person_id fk_friend_id/);
65            
66              
67             =head2 befriender
68              
69             The person that 'owns' the friendship (list)
70              
71             =cut
72              
73             __PACKAGE__
74             ->belongs_to( befriender => 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Person', {
75             'foreign.person_id' => 'self.fk_person_id' });
76              
77              
78             =head2 friendee
79              
80             The actual friend that befriender is listing
81              
82             =cut
83              
84             __PACKAGE__
85             ->belongs_to( friendee => 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Person', {
86             'foreign.person_id' => 'self.fk_friend_id' });
87              
88              
89             =head1 METHODS
90              
91             This module defines the following methods.
92              
93             =head1 AUTHOR
94              
95             Please see L<DBIx::Class::Schema::PopulateMore> For authorship information
96              
97             =head1 LICENSE
98              
99             Please see L<DBIx::Class::Schema::PopulateMore> For licensing terms.
100              
101             =cut
102              
103              
104             1;