1 package DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_040;
7 use base 'DBIx::Class::Schema::Loader::RelBuilder';
10 my ($self, $name) = @_;
12 return Lingua::EN::Inflect::Number::to_PL($name);
15 sub _relnames_and_method {
16 my ( $self, $local_moniker, $rel, $cond, $uniqs, $counters ) = @_;
18 my $remote_moniker = $rel->{remote_source};
19 my $remote_table = $self->{schema}->source( $remote_moniker )->from;
21 my $local_table = $self->{schema}->source($local_moniker)->from;
22 my $local_cols = $rel->{local_columns};
24 # for single-column case, set the remote relname to just the column name
26 scalar keys %{$cond} == 1
27 ? $self->_inflect_singular( values %$cond )
28 : $self->_inflect_singular( lc $remote_table );
30 # If more than one rel between this pair of tables, use the local
31 # col names to distinguish
33 if ($counters->{$remote_moniker} > 1) {
34 my $colnames = '_' . join( '_', @$local_cols );
35 $remote_relname .= $colnames if keys %$cond > 1;
36 $local_relname = $self->_inflect_plural( lc($local_table) . $colnames );
38 $local_relname = $self->_inflect_plural(lc $local_table);
41 return ( $local_relname, $remote_relname, 'has_many' );
50 DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_040 - RelBuilder for
51 compatibility with DBIx::Class::Schema::Loader version 0.04006
55 See L<DBIx::Class::Schema::Loader::Base/naming>.