ZF-8097: getValues only returns some values when using array notation in setElementsBelongsTo
Description
The getValues method only returns the last key in the array for sub forms of the same name. Finding it quite difficult to put into words so I will explain with a code sample.
$form = new Zend_Form();
$subForm1 = new Zend_Form_SubForm(); $subForm1->setElementsBelongTo("fields[0]"); $form->addSubForm($subForm1, "fields_0");
$subForm2 = new Zend_Form_SubForm(); $subForm2->setElementsBelongTo("fields[1]"); $form->addSubForm($subForm2, "fields_1");
After form submission and validation, the key "fields" contains only the values for $subForm2. This is because the values are merged using array_merge rather than array_merge_recursive.
Comments
Posted by Tom Graham (noginn) on 2009-10-19T09:48:37.000+0000
I have attached a patch file which includes a fix and test case for the issue.
Posted by Christian Albrecht (alab) on 2010-04-02T05:25:03.000+0000
ZF-9586 is similar, could you try if that works for you?
Posted by Christian Albrecht (alab) on 2010-04-16T09:43:24.000+0000
Resolving as duplicate of ZF-9586