ZF-10333: Zend_Form_Element::setBelongsTo() must override Zend_Form::setElementsBelongTo() individualy

Description

When I create a form using array notation, some elements should not follow the rule from the main form. For example:


$form = new Zend_Form;
$form->setElementsBelongTo('Foo');
$form->addElement('text', 'name');
$form->addElement('text', 'email');
$form->addElement('text', 'Bar', array('belongsTo' => 'subInfo'));

The output is:


While the correct output (because setBelongsTo() was called individualy) is:


Comments

From the docs:

??Zend_Form::setElementsBelongTo($array): Using this method, you can specify the name of an array to which all elements of the form belong.??

So by definition setElementsBelongTo() is intended to override individual elements.

I disagree,

So... if I need to use a ::subForm() or setBelongsTo() I can't set a particular name for my element?

If I am using a form that maps a model to be saved I can't use it.

I think that element renderization must be individual.

I am re-opening so that I can further investigate this as per a conversation I've had with [~guilhermeblanco]

I do agree as well with Daniel.

Actually at the moment it is hindering my work as i have few forms that need only one element to be with different belongsTo and in order for it to work I need to set it to all elements separately instead of set it for the form and then just to set it for that specific element that require it.

So I will appreciate it if anyone post an update to what are you going to decide regarding that matter. :)

PS.: The framework is great keep up the good work :)