Subject: | Virtual Columns in relationships do not persist if modified in new() during create |
If you modify a virtual column in a relationship inside new() while you're creating a new row, the virtual columns will not survive DBIx::Class::Row->insert.
DBIx::Class::Row->insert line 306 uses get_inflated_columns to get the data to create the new related row, which VirtualColumns does not implement.
I've attached a patch to implement get_inflated_columns, which fixes this problem.
DBIx::Class::Row->insert line 306 uses get_inflated_columns to get the data to create the new related row, which VirtualColumns does not implement.
I've attached a patch to implement get_inflated_columns, which fixes this problem.
Subject: | dbic-virtualcolumns-fix-get_inflated_columns.patch.txt |
--- VirtualColumns.pm.old 2009-12-27 16:26:32.000000000 -0600
+++ VirtualColumns.pm 2009-12-27 16:26:38.000000000 -0600
@@ -270,6 +270,17 @@
return %data;
}
+=head2 get_inflated_columns
+
+Overloaded method. L<DBIx::Class::Row/"get_inflated_columns">
+
+=cut
+
+sub get_inflated_columns {
+ my $self = shift;
+ return ($self->next::method(@_), %{$self->{_virtual_values}});
+}
+
=head2 store_column
Overloaded method. L<DBIx::Class::Row/"store_column">