From: Peter Rabbitson Date: Thu, 20 Nov 2008 10:25:32 +0000 (+0000) Subject: Trunk passes tests again - todoify everything multicreate related to branch it out... X-Git-Tag: v0.08240~226 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a7be8807654bc18bcae13a3f6ee30075d91aaca9;p=dbsrgits%2FDBIx-Class.git Trunk passes tests again - todoify everything multicreate related to branch it out, as the task turned out to be more complex (no indentation to aid future merging) --- diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 0d08638..c1fb2b0 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -761,24 +761,17 @@ sub set_inflated_columns { { my $rel = delete $upd->{$key}; $self->set_from_related($key => $rel); - $self->{_relationship_data}{$key} = $rel; + $self->{_relationship_data}{$key} = $rel; } elsif ($info && $info->{attrs}{accessor} - && $info->{attrs}{accessor} eq 'multi' - && ref $upd->{$key} eq 'ARRAY') { - my $others = delete $upd->{$key}; - foreach my $rel_obj (@$others) { - if(!Scalar::Util::blessed($rel_obj)) { - $rel_obj = $self->create_related($key, $rel_obj); - } - } - $self->{_relationship_data}{$key} = $others; -# $related->{$key} = $others; - next; + && $info->{attrs}{accessor} eq 'multi') { + $self->throw_exception( + "Recursive update is not supported over relationships of type multi ($key)" + ); } elsif ($self->has_column($key) && exists $self->column_info($key)->{_inflate_info}) { - $self->set_inflated_column($key, delete $upd->{$key}); + $self->set_inflated_column($key, delete $upd->{$key}); } } } diff --git a/t/66relationship.t b/t/66relationship.t index 224403c..3a96107 100644 --- a/t/66relationship.t +++ b/t/66relationship.t @@ -262,6 +262,8 @@ is ($@, '', 'Staged insertion successful'); ok($new_artist->in_storage, 'artist inserted'); ok($new_related_cd->in_storage, 'new_related_cd inserted'); +TODO: { +local $TODO = "TODOify for multicreate branch"; my $new_cd = $schema->resultset("CD")->new_result({}); my $new_related_artist = $new_cd->new_related('artist', { 'name' => 'Marillion',}); lives_ok ( @@ -285,3 +287,4 @@ cmp_ok($relinfo->{attrs}{is_foreign_key_constraint}, '==', 1, "is_foreign_key_co my $rs_overridden = $schema->source('ForceForeign'); my $relinfo_with_attr = $rs_overridden->relationship_info ('cd_3'); cmp_ok($relinfo_with_attr->{attrs}{is_foreign_key_constraint}, '==', 0, "is_foreign_key_constraint defined for belongs_to relationships with attr."); +} diff --git a/t/96multi_create.t b/t/96multi_create.t index e202c59..4445f3f 100644 --- a/t/96multi_create.t +++ b/t/96multi_create.t @@ -168,6 +168,8 @@ eval { }; diag $@ if $@; +TODO: { +local $TODO = "Todoify for multicreate branch"; # test might_have again but with a PK == FK in the middle (obviously not specified) eval { my $artist = $schema->resultset('Artist')->first; @@ -258,6 +260,7 @@ eval { ); }; diag $@ if $@; +} # nested find_or_create eval {