line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # hide from PAUSE |
2
|
|
|
|
|
|
|
DBIx::Class::Relationship::HasMany; |
3
|
|
|
|
|
|
|
|
4
|
379
|
|
|
379
|
|
174065
|
use strict; |
|
379
|
|
|
|
|
1215
|
|
|
379
|
|
|
|
|
10757
|
|
5
|
379
|
|
|
379
|
|
2088
|
use warnings; |
|
379
|
|
|
|
|
1083
|
|
|
379
|
|
|
|
|
8905
|
|
6
|
379
|
|
|
379
|
|
2008
|
use Try::Tiny; |
|
379
|
|
|
|
|
1144
|
|
|
379
|
|
|
|
|
21302
|
|
7
|
379
|
|
|
379
|
|
2499
|
use namespace::clean; |
|
379
|
|
|
|
|
1201
|
|
|
379
|
|
|
|
|
2603
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our %_pod_inherit_config = |
10
|
|
|
|
|
|
|
( |
11
|
|
|
|
|
|
|
class_map => { 'DBIx::Class::Relationship::HasMany' => 'DBIx::Class::Relationship' } |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub has_many { |
15
|
12333
|
|
|
12333
|
0
|
120855
|
my ($class, $rel, $f_class, $cond, $attrs) = @_; |
16
|
|
|
|
|
|
|
|
17
|
12333
|
100
|
|
|
|
33535
|
unless (ref $cond) { |
18
|
|
|
|
|
|
|
|
19
|
7337
|
|
|
|
|
175911
|
my $pri = $class->result_source_instance->_single_pri_col_or_die; |
20
|
|
|
|
|
|
|
|
21
|
7337
|
|
|
|
|
14309
|
my ($f_key,$guess); |
22
|
7337
|
100
|
66
|
|
|
34667
|
if (defined $cond && length $cond) { |
23
|
4950
|
|
|
|
|
34848
|
$f_key = $cond; |
24
|
4950
|
|
|
|
|
13827
|
$guess = "caller specified foreign key '$f_key'"; |
25
|
|
|
|
|
|
|
} else { |
26
|
2387
|
|
|
|
|
13250
|
$class =~ /([^\:]+)$/; # match is safe - $class can't be '' |
27
|
2387
|
|
|
|
|
7886
|
$f_key = lc $1; # go ahead and guess; best we can do |
28
|
2387
|
|
|
|
|
6438
|
$guess = "using our class name '$class' as foreign key source"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# FIXME - this check needs to be moved to schema-composition time... |
32
|
|
|
|
|
|
|
# # only perform checks if the far side appears already loaded |
33
|
|
|
|
|
|
|
# if (my $f_rsrc = try { $f_class->result_source_instance } ) { |
34
|
|
|
|
|
|
|
# $class->throw_exception( |
35
|
|
|
|
|
|
|
# "No such column '$f_key' on foreign class ${f_class} ($guess)" |
36
|
|
|
|
|
|
|
# ) if !$f_rsrc->has_column($f_key); |
37
|
|
|
|
|
|
|
# } |
38
|
|
|
|
|
|
|
|
39
|
7337
|
|
|
|
|
31745
|
$cond = { "foreign.${f_key}" => "self.${pri}" }; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
12333
|
100
|
|
|
|
36607
|
my $default_cascade = ref $cond eq 'CODE' ? 0 : 1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$class->add_relationship($rel, $f_class, $cond, { |
45
|
|
|
|
|
|
|
accessor => 'multi', |
46
|
|
|
|
|
|
|
join_type => 'LEFT', |
47
|
|
|
|
|
|
|
cascade_delete => $default_cascade, |
48
|
|
|
|
|
|
|
cascade_copy => $default_cascade, |
49
|
|
|
|
|
|
|
is_depends_on => 0, |
50
|
12333
|
100
|
|
|
|
27019
|
%{$attrs||{}} |
|
12333
|
|
|
|
|
125400
|
|
51
|
|
|
|
|
|
|
}); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |