Revision history for DBIx::Class
-
+ - fix bug with create_multi not inserting non-storage objects
+ (test and fix from davinchi)
- DBIx::Class::AccessorGroup made empty subclass of
Class::Accessor::Grouped
- fixed an ugly bug regarding $dbh->{AutoCommit} and transactions
my $rel_obj = delete $attrs->{$key};
if(!Scalar::Util::blessed($rel_obj)) {
$rel_obj = $new->find_or_new_related($key, $rel_obj);
- $new->{_rel_in_storage} = 0 unless ($rel_obj->in_storage);
}
+
+ $new->{_rel_in_storage} = 0 unless ($rel_obj->in_storage);
+
$new->set_from_related($key, $rel_obj);
$related->{$key} = $rel_obj;
next;
$rel_obj = $new->new_related($key, $rel_obj);
$new->{_rel_in_storage} = 0;
}
+
+ $new->{_rel_in_storage} = 0 unless ($rel_obj->in_storage);
}
$related->{$key} = $others;
next;
});
ok($cdp, 'join table record created ok');
+
+SPECIAL_CASE: {
+ my $kurt_cobain = { name => 'Kurt Cobain' };
+
+ my $in_utero = $schema->resultset('CD')->new({
+ title => 'In Utero',
+ year => 1993
+ });
+
+ $kurt_cobain->{cds} = [ $in_utero ];
+
+
+ $schema->resultset('Artist')->populate([ $kurt_cobain ]); # %)
+ $a = $schema->resultset('Artist')->find({name => 'Kurt Cobain'});
+
+ is($a->name, 'Kurt Cobain', 'Artist insertion ok');
+ is($a->cds && $a->cds->first && $a->cds->first->title,
+ 'In Utero', 'CD insertion ok');
+}
+
+SPECIAL_CASE2: {
+ my $pink_floyd = { name => 'Pink Floyd' };
+
+ my $the_wall = { title => 'The Wall', year => 1979 };
+
+ $pink_floyd->{cds} = [ $the_wall ];
+
+
+ $schema->resultset('Artist')->populate([ $pink_floyd ]); # %)
+ $a = $schema->resultset('Artist')->find({name => 'Pink Floyd'});
+
+ is($a->name, 'Pink Floyd', 'Artist insertion ok');
+ is($a->cds && $a->cds->first->title, 'The Wall', 'CD insertion ok');
+}