« blib/lib/DBIx/Class/Schema/Loader/Utils.pm
↑ Summary
blib/lib/DBIx/Class/Schema/Loader/RelBuilder/Compat/v0_05.pm »
| 1 | package DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_040; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use base 'DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_05'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use mro 'c3'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | our $VERSION = '0.07053'; | |||||||||
| 9 | |||||||||||
| 10 | 58 | ▶ | sub _relnames_and_method { | ||||||||
|
Subroutine
_relnames_and_method: called CC=4 SCAR=13.9
| |||||||||||
| 11 | 58 | my ( $self, $local_moniker, $rel, $cond, $uniqs, $counters ) = @_; | |||||||||
| 12 | |||||||||||
| 13 | 58 | my $remote_moniker = $rel->{remote_source}; | |||||||||
| 14 | 58 | my $remote_table = $rel->{remote_table}; | |||||||||
| 15 | |||||||||||
| 16 | 58 | my $local_table = $rel->{local_table}; | |||||||||
| 17 | 58 | 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 | ▶ | scalar keys %{$cond} == 1 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | my $remote_relname; | |||||||||
| 28 | 58 | ▶ | if ($counters->{$remote_moniker} > 1) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 16 | my $colnames = '_' . join( '_', @$local_cols ); | |||||||||
| 30 | 16 | ▶ | $local_relname .= $colnames if keys %$cond > 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 16 | ($remote_relname) = $self->_inflect_plural( lc($local_table) . $colnames ); | |||||||||
| 32 | } else { | ||||||||||
| 33 | 42 | ($remote_relname) = $self->_inflect_plural(lc $local_table); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 58 | return ( $local_relname, $remote_relname, 'has_many' ); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 58 | ▶ | sub _remote_attrs { } | ||||||||
|
Subroutine
_remote_attrs: called CC=1 SCAR=0.0
| |||||||||||
| 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<DBIx::Class::Schema::Loader::Base/naming> and | ||||||||||
| 49 | L<DBIx::Class::Schema::Loader::RelBuilder>. | ||||||||||
| 50 | |||||||||||
| 51 | =head1 AUTHORS | ||||||||||
| 52 | |||||||||||
| 53 | See L<DBIx::Class::Schema::Loader/AUTHORS>. | ||||||||||
| 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 | 2 | 1; | |||||||||