don't overwrite cached object fields on fetch all since we can't guarantee that it...
Matt S Trout [Sun, 10 Jan 2010 07:03:21 +0000 (07:03 +0000)]
lib/DBIx/Data/Collection/Set.pm
t/01basic_collection.t

index ceb1e3f..1acf096 100644 (file)
@@ -23,7 +23,7 @@ method _build__member_cache {
   while (my ($raw) = $stream->next) {
     my $obj = do {
       if (my ($obj) = $self->_key_cache_get_raw($raw)) {
-        $self->_merge($obj, $raw)
+        $obj # can't $self->_merge($obj, $raw) since $obj might have changed
       } else {
         $self->_add_to_key_cache($self->_inflate($raw))
       }
index c987036..9fded99 100644 (file)
@@ -133,4 +133,8 @@ is($pterry->{name}, 'Sir Pterry', 'Pterry retrieved by id');
 
 ok(!defined($set->get({ id => -1 })), 'undef on missing id');
 
+$pterry->{name} = 'Pterry';
+
+is_deeply([ sort_set $set->flatten ], \@expect, 'Basic data after fetch by id');
+
 done_testing;