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

Update collection recursive extract and populating nested fieldsets #5502

Closed
wants to merge 1 commit into from
Closed

Conversation

ltouro
Copy link
Contributor

@ltouro ltouro commented Nov 19, 2013

Appending the child object to the child fieldset instead the parent one. Setting values of child fieldset as the correct extract

Appending the child object to the child fieldset instead the parent one. Setting values of child fieldset as the correct extract
@fabiocarneiro
Copy link
Contributor

Thats much better than current code. At least it doesnt try to set an array to a fieldset. But it is still giving me errors. Also this test isnt passing #5495

@ltouro
Copy link
Contributor Author

ltouro commented Nov 19, 2013

For some reason, when dealing with nested fieldsets, you must to add a new Hydrator to then on the "mainFieldset" after adding it (even if in the target Fieldset you already add one):

on "mainFieldset":

    $this->add(array(
        'type' => 'Zend\Form\Element\Collection',
        'name' => 'specifications',
        'options' => array(
            'label' => 'Option specifications',
            'count' => 1,
            'allow_add' => true,
            'allow_remove' => true,
            'should_create_template' => true,
            'target_element' => new SpecificationFieldset($objectManager),
        ),
        'attributes' => array(
            'class' => 'nested-fieldset',
            'id' => 'opt_specifications',
        ),
    ));
    $this->get('specifications')->setHydrator(new DoctrineHydrator($objectManager));

on target Fieldset

$this->setHydrator(new DoctrineHydrator($objectManager))->setObject(new \Bundle\Entity\Specification());

Had to do that to solve my issue with nested fieldsets

@fabiocarneiro
Copy link
Contributor

That is very weird. @thestanislav, can you take a look?

@fabiocarneiro
Copy link
Contributor

I think this really should be merged asap. My nested forms are trying to bind arrays to fieldsets, which is obviouly wrong.

@fabiocarneiro
Copy link
Contributor

@thestanislav Are you still on this? Can i talk to you in #zftalk? What is your nickname?

@Maks3w
Copy link
Member

Maks3w commented Feb 23, 2014

Please add test cases

@weierophinney weierophinney added this to the 2.2.6 milestone Mar 3, 2014
@weierophinney weierophinney self-assigned this Mar 3, 2014
weierophinney added a commit that referenced this pull request Mar 3, 2014
Update collection recursive extract and populating nested fieldsets

Conflicts:
	library/Zend/Form/Element/Collection.php
weierophinney added a commit that referenced this pull request Mar 3, 2014
- Unit test passes now, meaning we can close both issues.
weierophinney added a commit that referenced this pull request Mar 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants