X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRow.pm;h=ac496f8a9eb13aab4f5f8d3c7ed05ff5b760d6aa;hb=4225194590a09e29451ba825c34483f98c1a0c03;hp=75b64db252e2998a598cfef329b799ee5f9ac9d9;hpb=63bb9738dd8fdca42ad88d99a2a3861ad2b00eed;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 75b64db..ac496f8 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -155,7 +155,7 @@ sub new { $new->result_source($source); } - if (my $related = delete $attrs->{-from_resultset}) { + if (my $related = delete $attrs->{-cols_from_relations}) { @{$new->{_ignore_at_insert}={}}{@$related} = (); } @@ -751,10 +751,27 @@ See L for how to setup inflation. sub get_inflated_columns { my $self = shift; - return map { - my $accessor = $self->column_info($_)->{'accessor'} || $_; - ($_ => $self->$accessor); - } grep $self->has_column_loaded($_), $self->columns; + + my %loaded_colinfo = (map + { $_ => $self->column_info($_) } + (grep { $self->has_column_loaded($_) } $self->columns) + ); + + my %inflated; + for my $col (keys %loaded_colinfo) { + if (exists $loaded_colinfo{$col}{accessor}) { + my $acc = $loaded_colinfo{$col}{accessor}; + if (defined $acc) { + $inflated{$col} = $self->$acc; + } + } + else { + $inflated{$col} = $self->$col; + } + } + + # return all loaded columns with the inflations overlayed on top + return ($self->get_columns, %inflated); } =head2 set_column @@ -785,7 +802,7 @@ sub set_column { $self->{_orig_ident} ||= $self->ident_condition; my $old_value = $self->get_column($column); - $self->store_column($column, $new_value); + $new_value = $self->store_column($column, $new_value); my $dirty; if (!$self->in_storage) { # no point tracking dirtyness on uninserted data