From: Dagfinn Ilmari Mannsåker Date: Tue, 29 Jul 2014 00:59:04 +0000 (+0100) Subject: Generate m2m rels in deterministic order X-Git-Tag: 0.07041~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b0436e27d8755a3173ef36668c7e910e3b7dbcf;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Generate m2m rels in deterministic order --- diff --git a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm index 0f07132..6bcba68 100644 --- a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm +++ b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm @@ -511,7 +511,8 @@ sub generate_code { sub _generate_m2ms { my ($self, $all_code) = @_; - while (my ($class, $rels) = each %$all_code) { + foreach my $class (sort keys %$all_code) { + my $rels = $all_code->{$class}; next unless (grep $_->{method} eq 'belongs_to', @$rels) == 2; my $class1_local_moniker = $rels->[0]{extra}{remote_moniker};