PopulateMore/Test/Schema/Result/CompanyPerson.pm

filter: Statementstmt 100% 10 / 10 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 11 / 11 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« PopulateMore/Test/Schema/Result/Company.pm ↑ Summary PopulateMore/Test/Schema/Result/EmploymentHistory.pm »
1 package #hide from pause
2 DBIx::Class::Schema::PopulateMore::Test::Schema::Result::CompanyPerson;
3  
4 3 ▶use parent 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 DBIx::Class::Schema::PopulateMore::Test::Schema::Result::CompanyPerson - Bridge between Company and Person
9  
10 =head1 DESCRIPTION
11  
12 Bridge table for many to many style relationship between Company and Person.
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 3 __PACKAGE__
29 ->table('company_person');
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 a companies
39  
40 =head3 fk_company_id
41  
42 ID of the company with persons
43  
44 =cut
45  
46 3 __PACKAGE__
47 ->add_columns(
48 fk_person_id => {
49 data_type=>'integer',
50 },
51 fk_company_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 3 __PACKAGE__
64 ->set_primary_key(qw/fk_person_id fk_company_id/);
65
66  
67 =head2 employee
68  
69 The person that is employed by a company
70  
71 =cut
72  
73 3 __PACKAGE__
74 ->belongs_to( employee => 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Person', {
75 'foreign.person_id' => 'self.fk_person_id' });
76  
77  
78 =head2 company
79  
80 The company that employees the person
81  
82 =cut
83  
84 3 __PACKAGE__
85 ->belongs_to( company => 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Company', {
86 'foreign.company_id' => 'self.fk_company_id' });
87  
88  
89 =head2 employment_history
90  
91 each instance of a company_person has a related employment history
92  
93 =cut
94  
95 3 __PACKAGE__
96 ->has_one (employment_history => 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result::EmploymentHistory', {
97 'foreign.fk_company_id' => 'self.fk_company_id',
98 'foreign.fk_person_id' => 'self.fk_person_id',
99 });
100  
101  
102 =head1 METHODS
103  
104 This module defines the following methods.
105  
106 =head1 AUTHOR
107  
108 Please see L<DBIx::Class::Schema::PopulateMore> For authorship information
109  
110 =head1 LICENSE
111  
112 Please see L<DBIx::Class::Schema::PopulateMore> For licensing terms.
113  
114 =cut
115  
116  
117 3 1;
« PopulateMore/Test/Schema/Result/Company.pm ↑ Summary PopulateMore/Test/Schema/Result/EmploymentHistory.pm »