X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FBase.pm;h=3cd33f1ff53185df27b33059ae0eb1b3ac6cde63;hb=f08818c44125aad840158cc95dff84d955a47411;hp=ab03a98bd3b8584cfb97919ff7de5f3cd9f889ea;hpb=ba12c8acfa1dd66cbea6c9cfd40a3a33244ab6bd;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index ab03a98..3cd33f1 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -20,12 +20,12 @@ use File::Temp (); use Class::Unload; use Class::Inspector (); use Scalar::Util 'looks_like_number'; -use DBIx::Class::Schema::Loader::Utils qw/split_name dumper_squashed eval_package_without_redefine_warnings class_path slurp_file sigwarn_silencer/; +use DBIx::Class::Schema::Loader::Utils qw/split_name dumper_squashed eval_package_without_redefine_warnings class_path slurp_file sigwarn_silencer firstidx uniq/; use DBIx::Class::Schema::Loader::Optional::Dependencies (); use Try::Tiny; use DBIx::Class (); use Encode qw/encode decode/; -use List::MoreUtils qw/all any firstidx uniq/; +use List::Util qw/all any none/; use File::Temp 'tempfile'; use namespace::clean; @@ -84,6 +84,7 @@ __PACKAGE__->mk_group_ro_accessors('simple', qw/ moniker_to_table uniq_to_primary quiet + allow_extra_m2m_cols /); @@ -993,6 +994,13 @@ Automatically promotes the largest unique constraints with non-nullable columns on tables to primary keys, assuming there is only one largest unique constraint. +=head2 allow_extra_m2m_cols + +Generate C relationship bridges even if the link table has +extra columns other than the foreign keys. The primary key must still +equal the union of the foreign keys. + + =head2 filter_generated_code An optional hook that lets you filter the generated text for various classes @@ -1283,7 +1291,7 @@ sub new { if (ref $self->moniker_parts ne 'ARRAY') { croak 'moniker_parts must be an arrayref'; } - if ((firstidx { $_ eq 'name' } @{ $self->moniker_parts }) == -1) { + if (none { $_ eq 'name' } @{ $self->moniker_parts }) { croak "moniker_parts option *must* contain 'name'"; } }