From: Marc Mims Date: Thu, 14 Sep 2017 23:58:54 +0000 (-0700) Subject: Ignore virtual columns in dump_object X-Git-Tag: v1.001037~2^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b97485a1cd713f9984775497a43044158bd961e;p=dbsrgits%2FDBIx-Class-Fixtures.git Ignore virtual columns in dump_object Don't dump virtual columns since they don't exist in the table and populate will choke. --- diff --git a/Changes b/Changes index e4dc63e..e8a1478 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,8 @@ Revision history for DBIx-Class-Fixtures {{$NEXT}} +- ignore virtual columns in dump_object + 1.001036 2016-03-21 14:59:55+00:00 UTC - releasing as stable @@ -102,7 +104,7 @@ Revision history for DBIx-Class-Fixtures 1.001013 - fixed functionality in last release by more deeply cloning parameters, which - prevents bad things when parameters get deleted in the wrong places. Also + prevents bad things when parameters get deleted in the wrong places. Also be sure we clear state properly after a dump. 1.001012 @@ -111,8 +113,8 @@ Revision history for DBIx-Class-Fixtures to make it easier when you need to dump all the fixtures programatically. - Added method 'dump_config_sets' to let you dump more than one set at a time more easily -- Added method 'dump_all_config_sets' which helps automate dumping all your - current config sets to a directory. +- Added method 'dump_all_config_sets' which helps automate dumping all your + current config sets to a directory. 1.001011 - Added an excludes resultsource option to the ->dump({all=>1,...}) feature diff --git a/lib/DBIx/Class/Fixtures.pm b/lib/DBIx/Class/Fixtures.pm index c979849..40e93cb 100644 --- a/lib/DBIx/Class/Fixtures.pm +++ b/lib/DBIx/Class/Fixtures.pm @@ -848,7 +848,14 @@ sub dump_object { # write file unless ($exists) { $self->msg('-- dumping ' . "$file", 2); - my %ds = $object->get_columns; + + # get_columns will return virtual columns; we just want stored columns. + # columns_info keys seems to be the actual storage column names, so we'll + # use that. + my $col_info = $src->columns_info; + my @column_names = keys %$col_info; + my %columns = $object->get_columns; + my %ds; @ds{@column_names} = @columns{@column_names}; if($set->{external}) { foreach my $field (keys %{$set->{external}}) {