X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FRelBuilder.pm;h=9e801434763af9806b996bbc657432064ace06e4;hb=38a64290c6c15538795ff18e6bc6c1ddcb67aab3;hp=b3ea5ef88c8d25f714b53d3eb1feab359ba2778f;hpb=ecf22f0ae0e0f639c0fc8dad9529a66b9374bfbd;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm index b3ea5ef..9e80143 100644 --- a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm +++ b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm @@ -17,7 +17,7 @@ use String::ToIdentifier::EN::Unicode (); use Class::Unload (); use Class::Inspector (); -our $VERSION = '0.07042'; +our $VERSION = '0.07049'; # Glossary: # @@ -94,16 +94,18 @@ This method will return the generated relationships as a hashref keyed on the class names. The values are arrayrefs of hashes containing method name and arguments, like so: - { - 'Some::Source::Class' => [ - { method => 'belongs_to', arguments => [ 'col1', 'Another::Source::Class' ], - { method => 'has_many', arguments => [ 'anothers', 'Yet::Another::Source::Class', 'col15' ], - ], - 'Another::Source::Class' => [ - # ... - ], - # ... - } + { + 'Some::Source::Class' => [ + { method => 'belongs_to', arguments => [ + 'col1', 'Another::Source::Class' ] }, + { method => 'has_many', arguments => [ + 'anothers', 'Yet::Another::Source::Class', 'col15' ] }, + ], + 'Another::Source::Class' => [ + # ... + ], + # ... + } =cut @@ -115,6 +117,7 @@ __PACKAGE__->mk_group_accessors('simple', qw/ relationship_attrs rel_collision_map rel_name_map + allow_extra_m2m_cols _temp_classes __tagger /); @@ -133,12 +136,11 @@ sub new { my $self = { loader => $loader, - schema => $loader->schema, - inflect_plural => $loader->inflect_plural, - inflect_singular => $loader->inflect_singular, - relationship_attrs => $loader->relationship_attrs, - rel_collision_map => $loader->rel_collision_map, - rel_name_map => $loader->rel_name_map, + (map { $_ => $loader->$_ } qw( + schema inflect_plural inflect_singular + relationship_attrs rel_collision_map + rel_name_map allow_extra_m2m_cols + )), _temp_classes => [], }; @@ -558,8 +560,10 @@ sub _generate_m2ms { my @link_table_primary_cols = @{[ $self->schema->source($link_moniker)->primary_columns ]}; - next unless uniq(@{$class[0]{from_link_cols}}, @{$class[1]{from_link_cols}}) == @link_table_cols - && @link_table_cols == @link_table_primary_cols; + next unless array_eq( + [ sort +uniq @{$class[0]{from_link_cols}}, @{$class[1]{from_link_cols}} ], + [ sort @link_table_primary_cols ], + ) && ($self->allow_extra_m2m_cols || @link_table_cols == @link_table_primary_cols); foreach my $this (0, 1) { my $that = $this ? 0 : 1; @@ -965,9 +969,9 @@ sub _cleanup { $self->_temp_classes([]); } -=head1 AUTHOR +=head1 AUTHORS -See L and L. +See L. =head1 LICENSE