From: Aaron Trevena Date: Fri, 23 Mar 2007 17:57:25 +0000 (+0000) Subject: applied patch from nicg : Modified DFV.pm to allow for multiple column primary keys X-Git-Tag: 2.12~18 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=c8353a63e48638b2f9cbf8bbc24c53825cc3212f;p=maypole.git applied patch from nicg : Modified DFV.pm to allow for multiple column primary keys git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@556 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/Maypole/Model/CDBI/DFV.pm b/lib/Maypole/Model/CDBI/DFV.pm index 7848759..ca3609c 100644 --- a/lib/Maypole/Model/CDBI/DFV.pm +++ b/lib/Maypole/Model/CDBI/DFV.pm @@ -181,8 +181,16 @@ sub _do_update { my $this_class_params = {}; + + + # NG changes start here. + # Code below fails to handle multi col PKs + my @pks = $class->columns('Primary'); + foreach my $param ( $class->columns ) { - next if ($param eq $class->columns('Primary')); + # next if ($param eq $class->columns('Primary')); + next if grep {/^${param}$/} @pks; + my $value = $r->params->{$param}; next unless (defined $value); $this_class_params->{$param} = ( $value eq '' ) ? undef : $value;