From: Aaron Trevena Date: Fri, 3 Nov 2006 11:17:39 +0000 (+0000) Subject: fixed bug in DFV model when updating object X-Git-Tag: 2.12~29 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=99967c293b1b617a0cac8126f923f6acfa2e4598;p=maypole.git fixed bug in DFV model when updating object git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@545 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/Maypole/Model/CDBI/AsForm.pm b/lib/Maypole/Model/CDBI/AsForm.pm index c072dc8..06f1039 100644 --- a/lib/Maypole/Model/CDBI/AsForm.pm +++ b/lib/Maypole/Model/CDBI/AsForm.pm @@ -983,7 +983,8 @@ sub _to_foreign_inputs { my $rel_meta = $args->{related_meta} || $self->related_meta('r',$accssr); my $fields = $args->{columns}; if (!$rel_meta) { - $self->_croak( "No relationship for accessor $accssr"); + $self->_carp( "[_to_foreign_inputs] No relationship for accessor $accssr"); + return; } my $rel_type = $rel_meta->{name}; diff --git a/lib/Maypole/Model/CDBI/DFV.pm b/lib/Maypole/Model/CDBI/DFV.pm index 5a74f71..a16fa30 100644 --- a/lib/Maypole/Model/CDBI/DFV.pm +++ b/lib/Maypole/Model/CDBI/DFV.pm @@ -140,6 +140,7 @@ sub do_edit : Exported { return; } + my $errors; if ($obj) { ($obj,$errors) = $class->_do_update($r,$obj); @@ -183,6 +184,7 @@ sub _do_update { } my $this_class_params = { map { $_ => $r->{params}{$_} } $class->columns }; + delete $this_class_params->{route_id}; # update or make other related (must_have, might_have, has_many etc ) unless ($errors) { @@ -190,7 +192,7 @@ sub _do_update { # get related object if it exists my $rel_meta = $class->related_meta('r',$accssr); if (!$rel_meta) { - $class->_carp("No relationship for $accssr in " . ref($class)); + $r->warn("[_do_update] No relationship for $accssr in " . ref($class)); next; } @@ -212,7 +214,6 @@ sub _do_update { } return ($obj,$errors); - } sub _do_create { @@ -257,7 +258,7 @@ sub _create_related { my $created = []; my $rel_meta = $self->related_meta('r',$accssr); if (!$rel_meta) { - $self->_carp("No relationship for $accssr in " . ref($self)); + $self->_carp("[_create_related] No relationship for $accssr in " . ref($self)); return; } diff --git a/lib/Maypole/Model/CDBI/FromCGI.pm b/lib/Maypole/Model/CDBI/FromCGI.pm index df0b9ff..7a725d1 100644 --- a/lib/Maypole/Model/CDBI/FromCGI.pm +++ b/lib/Maypole/Model/CDBI/FromCGI.pm @@ -514,7 +514,7 @@ sub _create_related { $created ||= []; my $rel_meta = $self->related_meta('r',$accssr); if (!$rel_meta) { - $self->_carp("No relationship for $accssr in " . ref($self)); + $self->_carp("[_create_related] No relationship for $accssr in " . ref($self)); return; } my $rel_type = $rel_meta->{name}; diff --git a/lib/Maypole/templates/factory/search_form b/lib/Maypole/templates/factory/search_form index 4882b7d..5d0fd90 100644 --- a/lib/Maypole/templates/factory/search_form +++ b/lib/Maypole/templates/factory/search_form @@ -9,8 +9,7 @@ [% FOR col = search_class.search_columns() %] [% END; %]