Author: spadkins
Date: Tue Oct 3 07:43:34 2006
New Revision: 7868
Modified:
p5ee/trunk/App-Repository/lib/App/RepositoryObject.pm
Log:
fix set() so it does the updates to DB from self correctly
Modified: p5ee/trunk/App-Repository/lib/App/RepositoryObject.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/RepositoryObject.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/RepositoryObject.pm Tue Oct 3
07:43:34 2006
@@ -134,9 +134,18 @@
$value = $self if (! defined $value && ref($attrib) eq "ARRAY");
my $nrows = $self->{_repository}->set($self->{_table}, $self->{_key},
$attrib, $value);
if (ref($attrib) eq "ARRAY") {
- for (my $i = 0; $i <= $#$attrib; $i++) {
- if ($nrows && exists $self->{$attrib->[$i]}) {
- $self->{$attrib->[$i]} = $value->[$i];
+ if (ref($value) eq "ARRAY") {
+ for (my $i = 0; $i <= $#$attrib; $i++) {
+ if ($nrows && exists $self->{$attrib->[$i]}) {
+ $self->{$attrib->[$i]} = $value->[$i];
+ }
+ }
+ }
+ elsif ($value ne $self) {
+ for (my $i = 0; $i <= $#$attrib; $i++) {
+ if ($nrows && exists $self->{$attrib->[$i]}) {
+ $self->{$attrib->[$i]} = $value->{$attrib->[$i]};
+ }
}
}
}