line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
980
|
use 5.20.0; |
|
2
|
|
|
|
|
6
|
|
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
51
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
94
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DBIx::Class::Smooth::Helper::Row::JoinTable; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Short intro |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
9
|
|
|
|
|
|
|
our $VERSION = '0.0102'; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
10
|
use parent 'DBIx::Class::Row'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
12
|
2
|
|
|
2
|
|
107
|
use String::CamelCase; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
13
|
2
|
|
|
2
|
|
10
|
use Module::Loader; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
30
|
|
14
|
2
|
|
|
2
|
|
9
|
use Syntax::Keyword::Try; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
15
|
2
|
|
|
2
|
|
93
|
use Carp qw/croak/; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
93
|
|
16
|
2
|
|
|
2
|
|
11
|
use DBIx::Class::Candy::Exports; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
17
|
2
|
|
|
2
|
|
664
|
use DBIx::Class::Smooth::Helper::Util qw/result_source_to_class result_source_to_relation_name clean_source_name/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
15
|
|
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
396
|
use experimental qw/postderef signatures/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
export_methods [qw/ |
22
|
|
|
|
|
|
|
join_table |
23
|
|
|
|
|
|
|
/]; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
state $module_loader = Module::Loader->new; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
2
|
0
|
9962
|
sub join_table($self, $left_source, $right_source) { |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
4
|
|
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
7
|
my $left_class = result_source_to_class($self, $left_source); |
30
|
2
|
|
|
|
|
6
|
my $right_class = result_source_to_class($self, $right_source); |
31
|
2
|
|
|
|
|
4
|
my $via_class = $self; |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
20
|
my $to_via_relation_name = result_source_to_relation_name($via_class, 1); |
34
|
2
|
|
|
|
|
8
|
my $via_to_right_relation_name = result_source_to_relation_name($right_source, 0); |
35
|
2
|
|
|
|
|
5
|
my $left_to_right_relation_name = result_source_to_relation_name($right_source, 1); |
36
|
2
|
|
|
|
|
7
|
my $via_to_left_relation_name = result_source_to_relation_name($left_source, 0); |
37
|
2
|
|
|
|
|
6
|
my $right_to_left_relation_name = result_source_to_relation_name($left_source, 1); |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
5
|
my $left_column_name_in_via = $via_to_left_relation_name . '_id'; |
40
|
2
|
|
|
|
|
5
|
my $right_column_name_in_via = $via_to_right_relation_name . '_id'; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
17
|
$via_class->primary_belongs($left_source, { _smooth_foreign_key => 1 }); |
43
|
2
|
|
|
|
|
309
|
$via_class->primary_belongs($right_source, { _smooth_foreign_key => 1 }); |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
303
|
$module_loader->load($left_class); |
46
|
2
|
|
|
|
|
64
|
$module_loader->load($right_class); |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
65
|
$left_class->many_to_many($left_to_right_relation_name, $to_via_relation_name, $via_to_right_relation_name); |
49
|
2
|
|
|
|
|
270
|
$right_class->many_to_many($right_to_left_relation_name, $to_via_relation_name, $via_to_left_relation_name); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=encoding UTF-8 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
DBIx::Class::Smooth::Helper::Row::JoinTable - Short intro |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Version 0.0102, released 2019-12-22. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SOURCE |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-DBIx-Class-Smooth> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 HOMEPAGE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
L<https://metacpan.org/release/DBIx-Class-Smooth> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Erik Carlsson. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
85
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |