From: Arthur Axel "fREW" Schmidt Date: Wed, 11 Nov 2009 22:50:43 +0000 (+0000) Subject: RT50828 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=18d80024c95f440cf8a7600f4340ef5247c6b15a;p=dbsrgits%2FDBIx-Class-Historic.git RT50828 --- diff --git a/Changes b/Changes index f1b561a..25707cb 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for DBIx::Class + - Fix populate with has_many bug + (RT #50828) - Fix Oracle autoincrement broken for Resultsets with scalar refs (RT #50874) - Complete Sybase RDBMS support including: diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index ca16242..f91676f 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1850,7 +1850,7 @@ sub populate { foreach my $rel (@rels) { next unless $item->{$rel} && ref $item->{$rel} eq "ARRAY"; - my $parent = $self->find(map {{$_=>$item->{$_}} } @pks) + my $parent = $self->find({map { $_ => $item->{$_} } @pks}) || $self->throw_exception('Cannot find the relating object.'); my $child = $parent->$rel; diff --git a/t/100populate.t b/t/100populate.t index 2e30a17..5237480 100644 --- a/t/100populate.t +++ b/t/100populate.t @@ -296,4 +296,24 @@ for ( ok ($row, "Stringification test row '$_' properly inserted"); } +lives_ok { + $schema->resultset('TwoKeys')->populate([{ + artist => 1, + cd => 5, + fourkeys_to_twokeys => [{ + f_foo => 1, + f_bar => 1, + f_hello => 1, + f_goodbye => 1, + autopilot => 'a', + },{ + f_foo => 2, + f_bar => 2, + f_hello => 2, + f_goodbye => 2, + autopilot => 'b', + }] + }]) +} 'fix RT50828'; + done_testing;