Revision history for Perl extension DBIx::Class::Schema::Loader
+ - better inflection using Lingua::EN::Inflect::Phrase
- cascade_delete and cascade_copy are turned off for has_many/might_have
by default, and belongs_to has on_delete => 'CASCADE' and on_update =>
'CASCADE' by default, overridable via relationship_attrs
requires 'Scalar::Util' => 0;
requires 'Data::Dump' => '1.06';
requires 'Lingua::EN::Inflect::Number' => '1.1';
+requires 'Lingua::EN::Inflect::Phrase' => '0.02';
requires 'Text::Balanced' => 0;
requires 'Digest::MD5' => '2.36';
requires 'Class::Accessor::Grouped' => '0.09002';
use Class::C3;
use Carp::Clan qw/^DBIx::Class/;
use Lingua::EN::Inflect::Number ();
+use Lingua::EN::Inflect::Phrase ();
our $VERSION = '0.05003';
my ($self, $name) = @_;
$name =~ s/_/ /g;
- my $plural = Lingua::EN::Inflect::Number::to_PL($name);
+ my $plural = Lingua::EN::Inflect::Phrase::to_PL($name);
$plural =~ s/ /_/g;
return $plural;
sub _to_S {
my ($self, $name) = @_;
- return Lingua::EN::Inflect::Number::to_S($name);
+ $name =~ s/_/ /g;
+ my $singular = Lingua::EN::Inflect::Phrase::to_S($name);
+ $singular =~ s/ /_/g;
+
+ return $singular;
}
sub _default_relationship_attrs { +{
use strict;
use warnings;
use Class::C3;
+use Lingua::EN::Inflect::Number ();
use base 'DBIx::Class::Schema::Loader::RelBuilder';
return Lingua::EN::Inflect::Number::to_PL($name);
}
+sub _to_S {
+ my ($self, $name) = @_;
+
+ return Lingua::EN::Inflect::Number::to_S($name);
+}
+
sub _relnames_and_method {
my ( $self, $local_moniker, $rel, $cond, $uniqs, $counters ) = @_;