X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRow.pm;h=e4d885a964f7db06ab85df5ac6f3944a0cf5a266;hb=fdb8385a961f14c3fd4ecf321c7ea6465066d306;hp=f4d33cb23144691013209082d3b2bc32fbafaabe;hpb=8222f722a1ee2a6d466f80e2fe9db9640a91edbe;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index f4d33cb..e4d885a 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -142,6 +142,9 @@ sub insert { if $self->can('result_source_instance'); $self->throw_exception("No result_source set on this object; can't insert") unless $source; + #use Data::Dumper; warn Dumper($self); + # Check if we stored uninserted relobjs here in new() + $source->storage->txn_begin if(!$self->{_rel_in_storage}); # Check if we stored uninserted relobjs here in new() my %related_stuff = (%{$self->{_relationship_data} || {}}, @@ -402,6 +405,22 @@ sub get_dirty_columns { keys %{$self->{_dirty_columns}}; } +=head2 get_inflated_columns + + my $inflated_data = $obj->get_inflated_columns; + +Similar to get_columns but objects are returned for inflated columns instead of their raw non-inflated values. + +=cut + +sub get_inflated_columns { + my $self = shift; + return map { + my $accessor = $self->column_info($_)->{'accessor'} || $_; + ($_ => $self->$accessor); + } $self->columns; +} + =head2 set_column $obj->set_column($col => $val); @@ -542,6 +561,7 @@ sub inflate_result { $fetched = $pre_source->result_class->inflate_result( $pre_source, @{$pre_val}); } + $new->related_resultset($pre)->set_cache([ $fetched ]); my $accessor = $source->relationship_info($pre)->{attrs}{accessor}; $class->throw_exception("No accessor for prefetched $pre") unless defined $accessor;