Preferences/Schema/Result/PrfOwner.pm

filter: Statementstmt 92.0% 23 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 90.3% 28 / 31 CC 1 SCAR 1.5
CC
1
Cov
92%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Preferences/Schema/ResultSet/PrfDefaultValues.pm ↑ Summary FB11X/Model/PreferencesDB.pm »
1  
2 package OpusVL::Preferences::Schema::Result::PrfOwner;
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use MooseX::NonMoose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 extends 'DBIx::Class::Core';
11  
12 1 __PACKAGE__->table("prf_owners");
13  
14 1 __PACKAGE__->add_columns
15 (
16 prf_owner_id =>
17 {
18 data_type => "integer",
19 is_nullable => 0
20 },
21  
22 prf_owner_type_id =>
23 {
24 data_type => "integer",
25 is_nullable => 0,
26 },
27 );
28  
29 1 __PACKAGE__->set_primary_key("prf_owner_id", "prf_owner_type_id");
30  
31  
32 1 __PACKAGE__->has_many
33 (
34 prf_preferences => "OpusVL::Preferences::Schema::Result::PrfPreference",
35 {
36 "foreign.prf_owner_id" => "self.prf_owner_id",
37 "foreign.prf_owner_type_id" => "self.prf_owner_type_id",
38 },
39 { join_type => 'left' }
40 );
41  
42 1 __PACKAGE__->belongs_to
43 (
44 prf_owner_types => 'OpusVL::Preferences::Schema::Result::PrfOwnerType',
45 {
46 'foreign.prf_owner_type_id' => 'self.prf_owner_type_id'
47 }
48 );
49  
50 __PACKAGE__->has_many
51 (
52 _by_name => 'OpusVL::Preferences::Schema::Result::PrfPreference',
53 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
54 0 my $args = shift;
55 return (
56 {
57 0 "$args->{foreign_alias}.prf_owner_id" => { -ident => "$args->{self_alias}.prf_owner_id" },
58 "$args->{foreign_alias}.prf_owner_type_id" => { -ident => "$args->{self_alias}.prf_owner_type_id" },
59 "$args->{foreign_alias}.name" => \"= ?",
60 }
61 );
62 },
63 1 );
64  
65  
66 1 return 1;
67  
68  
69 =head1 DESCRIPTION
70  
71 This table associates PrfOwnerTypes with actual objects from the corresponding
72 table. The C<owner_id> tells us which object it is, and the C<owner_type_id>
73 links to the PrfOwnerType class, which tells us which table and resultset it is.
74  
75 I don't know why it's necessary to store which rows from the host table have a
76 preferences object stored against them, without also storing that preferences
77 object in the same place.
78  
79 =head1 METHODS
80  
81 =head1 ATTRIBUTES
82  
83 =head2 prf_preferences
84  
85 =head2 prf_owner_types
86  
87 =head2 prf_owner_id
88  
89 =head2 prf_owner_type_id
90  
91  
92 =head1 LICENSE AND COPYRIGHT
93  
94 Copyright 2012 OpusVL.
95  
96 This software is licensed according to the "IP Assignment Schedule" provided with the development project.
97  
98 =cut
« Preferences/Schema/ResultSet/PrfDefaultValues.pm ↑ Summary FB11X/Model/PreferencesDB.pm »