File Coverage

blib/lib/DBIx/Class/Schema/Loader/RelBuilder/Compat/v0_040.pm
Criterion Covered Total %
statement 26 26 100.0
branch 4 6 66.6
condition n/a
subroutine 6 6 100.0
pod n/a
total 36 38 94.7


line stmt bran cond sub pod time code
1             package DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_040;
2              
3 2     2   1595 use strict;
  2         7  
  2         64  
4 2     2   11 use warnings;
  2         5  
  2         60  
5 2     2   12 use base 'DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_05';
  2         5  
  2         1351  
6 2     2   15 use mro 'c3';
  2         6  
  2         10  
7              
8             our $VERSION = '0.07051';
9              
10             sub _relnames_and_method {
11 58     58   208 my ( $self, $local_moniker, $rel, $cond, $uniqs, $counters ) = @_;
12              
13 58         148 my $remote_moniker = $rel->{remote_source};
14 58         120 my $remote_table = $rel->{remote_table};
15              
16 58         124 my $local_table = $rel->{local_table};
17 58         103 my $local_cols = $rel->{local_columns};
18              
19             # for single-column case, set the remote relname to just the column name
20             my ($local_relname) =
21 58 50       116 scalar keys %{$cond} == 1
  58         373  
22             ? $self->_inflect_singular( values %$cond )
23             : $self->_inflect_singular( lc $remote_table );
24              
25             # If more than one rel between this pair of tables, use the local
26             # col names to distinguish
27 58         52629 my $remote_relname;
28 58 100       216 if ($counters->{$remote_moniker} > 1) {
29 16         70 my $colnames = '_' . join( '_', @$local_cols );
30 16 50       64 $local_relname .= $colnames if keys %$cond > 1;
31 16         68 ($remote_relname) = $self->_inflect_plural( lc($local_table) . $colnames );
32             } else {
33 42         184 ($remote_relname) = $self->_inflect_plural(lc $local_table);
34             }
35              
36 58         83271 return ( $local_relname, $remote_relname, 'has_many' );
37             }
38              
39       58     sub _remote_attrs { }
40              
41             =head1 NAME
42              
43             DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_040 - RelBuilder for
44             compatibility with DBIx::Class::Schema::Loader version 0.04006
45              
46             =head1 DESCRIPTION
47              
48             See L and
49             L.
50              
51             =head1 AUTHORS
52              
53             See L.
54              
55             =head1 LICENSE
56              
57             This library is free software; you can redistribute it and/or modify it under
58             the same terms as Perl itself.
59              
60             =cut
61              
62             1;