| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package #hide from pause |
|
2
|
|
|
|
|
|
|
DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Company; |
|
3
|
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
1931
|
use parent 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result'; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Company - A Company Class |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Companies are entities people work for. A person can work for one or more |
|
13
|
|
|
|
|
|
|
companies. For the purposed of making this easy (for now) we will say that |
|
14
|
|
|
|
|
|
|
a company can exist without employees and that there is no logic preventing |
|
15
|
|
|
|
|
|
|
a person from working for more than one company at a time. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 PACKAGE METHODS |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This module defines the following package methods |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 table |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Name of the Physical table in the database |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__PACKAGE__ |
|
28
|
|
|
|
|
|
|
->table('company'); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 add_columns |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Add columns and meta information |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head3 company_id |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Primary Key which is an auto generated autoinc |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head3 name |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The company's name |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__PACKAGE__ |
|
46
|
|
|
|
|
|
|
->add_columns( |
|
47
|
|
|
|
|
|
|
company_id => { |
|
48
|
|
|
|
|
|
|
data_type=>'integer', |
|
49
|
|
|
|
|
|
|
}, |
|
50
|
|
|
|
|
|
|
name => { |
|
51
|
|
|
|
|
|
|
data_type=>'varchar', |
|
52
|
|
|
|
|
|
|
size=>64, |
|
53
|
|
|
|
|
|
|
}); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 primary_key |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Sets the Primary keys for this table |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__PACKAGE__ |
|
63
|
|
|
|
|
|
|
->set_primary_key(qw/company_id/); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 company_persons |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Each Company might have a resultset from the company_person table. This is a |
|
69
|
|
|
|
|
|
|
bridge table in a many-many type relationship |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__PACKAGE__ |
|
74
|
|
|
|
|
|
|
->has_many( |
|
75
|
|
|
|
|
|
|
company_persons => 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result::CompanyPerson', |
|
76
|
|
|
|
|
|
|
{'foreign.fk_company_id' => 'self.company_id'}); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 employees |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
A resultset of Persons via a resultset of connecting CompanyPersons |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__PACKAGE__ |
|
86
|
|
|
|
|
|
|
->many_to_many( employees => 'company_persons', 'employee' ); |
|
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; |