blib/lib/ObjectDB/Meta/Relationship/ManyToOne.pm

filter: Statementstmt 35.4% 11 / 31 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 25.9% 14 / 54 CC 6 SCAR 31.6
CC
6
Cov
26%
to_source
42.0
type
2.0
is_multi
2.0
CRAP 23.5
« blib/lib/ObjectDB.pm ↑ Summary blib/lib/ObjectDB/Meta.pm »
1 package ObjectDB::Meta::Relationship::ManyToOne;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use base 'ObjectDB::Meta::Relationship';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '3.26';
9  
10 0 ▶sub type { 'many to one' }
Subroutine type: not called CC=1 SCAR=6.9
Pod undocumented
11 0 ▶sub is_multi { 0 }
Subroutine is_multi: not called CC=1 SCAR=6.9
Pod undocumented
12  
13 sub to_source {
14 0 ▶ my $self = shift;
Subroutine to_source: not called CC=6 SCAR=37.4
Pod undocumented
15 0 my (%options) = @_;
16  
17 0 my $name = $self->name;
18 0 ▶ my $name_prefix = $options{name_prefix} || '';
Condition0%0/2
$options{'name_prefix'} || ''
l!l
00
MC/DC0%0/1
$options{'name_prefix'} || ''
$options{'name_prefix'}
Truth table0%0/2
A
A= $options{'name_prefix'}
Aresult
11
00
19 0 ▶ my $table = $options{table} || $self->orig_class->meta->table;
Condition0%0/3
$options{'table'} || $self->orig_class->meta->table
l!l&&r!l&&!r
000
MC/DC0%0/2
$options{'table'} || $self->orig_class->meta->table
$options{'table'} $self->orig_class->meta->table
Truth table0%0/3
A || B
A= $options{'table'}B= $self->orig_class->meta->table
ABresult
1X1
011
000
20 0 my $rel_table = $self->class->meta->table;
21  
22 0 my ($from, $to) = %{ $self->{map} };
23  
24 my $constraint = [
25 "$table.$from" => { -col => "$name_prefix$name.$to" },
26 0 ▶ @{ $self->{constraint} || [] }
Branch: 1 branch
BranchTrueFalseTotal
$self->{"constraint"} or [] 0 0 0
27 ];
28  
29 0 my @columns;
30 0 ▶ if ($options{columns}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options{'columns'}) { } 0 0 0
31 $options{columns} = [ $options{columns} ]
32 0 ▶ unless ref $options{columns} eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $options{"columns"} eq "ARRAY" 0 0 0
33 0 @columns = @{ $options{columns} };
34 0 unshift @columns, $self->class->meta->get_primary_key;
35 }
36 else {
37 0 @columns = $self->class->meta->get_columns;
38 }
39  
40 return {
41 table => $rel_table,
42 as => $name,
43 join => $self->{join},
44 0 constraint => $constraint,
45 columns => [@columns]
46 };
47 }
48  
49 1 1;
« blib/lib/ObjectDB.pm ↑ Summary blib/lib/ObjectDB/Meta.pm »