Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Extract and populate values for nested fieldsets in Collection elements #5093

Closed

Conversation

thestanislav
Copy link
Contributor

If collection element has nested fieldsets, objects are never bound and values are never extracted or populated.
This should fix it

if ($fieldset->allowObjectBinding($object)) {
$fieldset->setObject($object);
$values[$name] = $fieldset->extract();
}else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space before else.

@bakura10
Copy link
Contributor

bakura10 commented Sep 9, 2013

Change makes sense to me. Could you add a test please ? :)

@thestanislav
Copy link
Contributor Author

Actually this issue is not related with input filters. The fix should just populate values on nested elements and fieldsets those collection has and also bind objects to fieldsets.

$fieldset->setObject($object);
$values[$name] = $fieldset->extract();
} else {
foreach($fieldset->fieldsets as $childFieldset){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add space after foreach before and after open/close parenthesis.

@ghost ghost assigned weierophinney Oct 22, 2013
weierophinney added a commit that referenced this pull request Oct 22, 2013
Extract and populate values for nested fieldsets in Collection elements
weierophinney added a commit that referenced this pull request Oct 22, 2013
@berny46
Copy link

berny46 commented Nov 19, 2013

This new code block in Collection.php breaks my application. I'm using ZF2 with Doctrine 2 and before the change, all my values in nested elements were populated. Removing the new code block leads to a working application again.

@fabiocarneiro
Copy link
Contributor

Same here. Ive added a failing test for that. #5495 . But if you notice its necessary, since without it, the nested fieldsets does not have objects. Something is wrong with that code, but i dont know what.

danizord added a commit to danizord/FhcsFormTest that referenced this pull request Dec 12, 2013
This commit modifies the IndexController to test the really needed behavior: $form->bind()

The problem: $form->bind() method was throwing an unespected exception.
This problem was introduced in ZF 2.2.5 through zendframework/zendframework#5093

So the fatest solution would be downgrade to ZF 2.2.4, then lets make it :D
thestanislav added a commit to thestanislav/zf2 that referenced this pull request Apr 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants