Issues

ZF-9451: Zend_Form* elementsBelongTo and belongsTo coexistence

Description

At the moment setting elementsBelongTo on a (Sub)Form overwrites the belongsTo setting of any Element appended to this form.

This fix makes it possible to have belongsTo indepedent from elementsBelongTo in a manner that when setting elementsBelongTo the value is stored in an extra member within Zend_Form_Element, namely belongsToBase, after stripping the old belongsToBase from belongsTo, and prepending the new belongsToBase to belongsTo.


$form    = new Zend_Form(...'elementsBelongTo' => 'form[elementsBelongTo]'...);
$element = new Zend_Form_Element(...'name' => 'element' ... 'belongsTo' => 'belongsTo'...);
$form->addElement($element);

/** Before Patch */
$element->getFullyQualifiedName(); // form[elementsBelongTo][element]

/** After Patch */
$element->getFullyQualifiedName(); // form[elementsBelongTo][belongsTo][element]

Comments

After talking to Matthew it is clear now that elementsBelongTo supersedes belongsTo so i close this issue.