Subject: | Changes between 0.12 and 0.13 |
Date: | Mon, 17 May 2010 14:50:36 +0200 |
To: | bug-DBIx-Class-ResultSet-RecursiveUpdate [...] rt.cpan.org |
From: | Martin Rusko <martin.rusko [...] gmail.com> |
Hi,
I've noticed that since upgrade from 0.12 version to 0.13 version database
is not being updated if column referencing another table is set to null.
I'm using HTML-FormHandler module together with HTML-FormHandler-Model-DBIC
which uses RecursiveUpdate to update database rows. There is table 'sites'
which can refer to table 'contacts', but not necessarily (is_nullable) ...
"contact_id",
{
data_type => "integer",
default_value => undef,
is_foreign_key => 1,
is_nullable => 1,
},
__PACKAGE__->belongs_to(
"contact",
"ZoneDB::Schema::Result::Contact",
{ contact_id => "contact_id" },
{ join_type => "LEFT" },
);
If I choose in form "empty_value", in object values contact is null. But it
looks like RecursiveUpdate don't consider object being changed or what, and
with recent change the row won't get updated ...
@@ -107,8 +107,7
@@
# don't allow insert to recurse to related objects - we do the recursion
ourselves
# $object->{_rel_in_storage} = 1;
- $object->update_or_insert;
-
+ $object->update_or_insert if $object->is_changed;
# updating many_to_many
for my $name ( keys %$updates ) {
Is it really a bug or is it expected behavior, please? I'm bit lost.
Thanks and Best Regards,
Martin