Subject: | multiple nested fields.. |
When processing multiple nested fields, (i.e. a Fieldset with a
nested_name inside a Fieldset with a nested_name etc.), Model::DBIC will
only process the first level of nested fields, but skips any remaining
levels.
Attached is a patch which fixes the issue. (Looks like that was the
purpose of having repeat_base, but repeat_base was just never checked.)
Subject: | formfu_nested_repeatable.patch |
--- lib/perl5/HTML/FormFu/Model/DBIC.pm 2009-10-19 10:31:08.000000000 -0500
+++ lib/HTML/FormFu/Model/DBIC.pm 2009-10-19 10:57:07.000000000 -0500
@@ -467,7 +468,21 @@
next if !defined $block && !defined $multi_value;
next if !$form->valid($rel);
- my $params = $form->param($rel);
+ ### Patch to fix creating nested related objects.
+ ### This will cause $form->param to return the correct value on nested fields
+ ### which will fix the below elsif case, to see $params as a HASH, when that is the case.
+ my $base_rel = $attrs->{repeat_base};
+ my $params;
+ # if repeat_base was defined..
+ if (defined($base_rel)) {
+ # then this is an iteration, not the original call to update -> _save rels..
+ # hence the field name is different than normal. get the params for the right field name.
+ $params = $form->param($base->nested_name);
+ } else {
+ # just get the params as normal.
+ $params = $form->param($rel);
+ }
+ ### End of Patch to fix nested object creation.
if ( defined $block && $block->is_repeatable ) {