Revision history for DBIx::Class
+ - populate() now properly reports the dataset slice in case of
+ an exception
+ - fixed corner case when populate() erroneously falls back to
+ create()
+
0.08103 2009-05-26 19:50:00 (UTC)
- Multiple $resultset -> count/update/delete fixes. Now any
of these operations will succeed, regardless of the complexity
## do the belongs_to relationships
foreach my $index (0..$#$data) {
- if( grep { !defined $data->[$index]->{$_} } @pks ) {
- my @ret = $self->populate($data);
- return;
+
+ # delegate to create() for any dataset without primary keys with specified relationships
+ if (grep { !defined $data->[$index]->{$_} } @pks ) {
+ for my $r (@rels) {
+ if (grep { ref $data->[$index]{$r} eq $_ } qw/HASH ARRAY/) { # a related set must be a HASH or AoH
+ my @ret = $self->populate($data);
+ return;
+ }
+ }
}
foreach my $rel (@rels) {
- next unless $data->[$index]->{$rel} && ref $data->[$index]->{$rel} eq "HASH";
+ next unless ref $data->[$index]->{$rel} eq "HASH";
my $result = $self->related_resultset($rel)->create($data->[$index]->{$rel});
my ($reverse) = keys %{$self->result_source->reverse_relationship_info($rel)};
my $related = $result->result_source->_resolve_condition(
$schema->populate('CD', [
map {
{
- cdid => $i++, # without a PK the bulk insert does not engage - how come?
artist => $artist->id,
title => $_,
year => 2009,