ZF2, controller doesn't fill the form elements from hydrated objects that are attached to the form
<p>In ZF2, I have a form that has two fieldsets. The 2 fieldsets are basically for party-related info (party = person or company) and phone-related info. The fieldsets are called using the init method of the form like this</p>

<pre><code>class PhoneRegistrationForm extends RegistrationForm implements InputFilterAwareInterface
{
    public function __construct()
    {
        parent::__construct();

        $this
            -&gt;setAttribute('method', 'post')
            -&gt;setHydrator(new ClassMethods(false))
            -&gt;setObject(new Phone());

        $this-&gt;add([
            'type' =&gt; 'Zend\Form\Element\Button',
            'name' =&gt; 'submitButton',
            'attributes' =&gt; [
                'id' =&gt; 'submit-phone-button',
                'class' =&gt; 'btn2 submit-button',
                'type' =&gt; 'submit',
            ],
            'options' =&gt; [
                'label' =&gt; 'Сохранить',
            ],
        ]);
    }

    public function init()
    {
        $this-&gt;add([
            'type' =&gt; 'Parties\Forms\Fieldsets\PhoneFieldset',
            'name' =&gt; 'phoneFieldset'
        ]);

        $this-&gt;add([
            'type' =&gt; 'Parties\Forms\Fieldsets\PartyIdAndRolesFieldset',
            'name' =&gt; 'partyFieldset'
        ]);
    }
}
</code></pre>

<p>In the controller's edit action, I create and hydrate the PhoneObject and PartyObject with the values from the database (PhoneObject and PartyObjects are just collection of getters and setters). I then set the hydrated objects to the fieldsets:</p>

<pre><code>$this-&gt;form-&gt;get('phoneFieldset')-&gt;setObject($phone);
$this-&gt;form-&gt;get('partyFieldset')-&gt;setObject($party);
</code></pre>

<p>And here is my problem, if I return the instance of form to the controller, the form inputs have no values that come from the attached hydrated objects.</p>

<p>How to get the form inputs filled with the values from the hydrated objects attached to fieldsets?</p>

<p>I tried binding <code>$this-&gt;form-&gt;bind($phone)</code>, but to no avail. The fieldsets have <code>ClassMethods()</code> hydrator set too.</p>

<p>What could the problem be? Any clues? </p>

<p>EDIT: after answer by @hooli, this is the code for the fieldset that I use.</p>

<pre><code>class PhoneFieldsetFactory extends Fieldset implements InputFilterProviderInterface
{
    public function __invoke(FormElementManager $formElementManager)
    {
        $this
            -&gt;setHydrator(new ClassMethods())
            -&gt;setObject(new Phone());

        $this-&gt;add([
            'type' =&gt; 'hidden',
            'name' =&gt; 'id',
        ]);

        $this-&gt;add(
            $formElementManager
                -&gt;get('Parties\Forms\Elements\ContactMechanismTypeSelect',
                    ['mechanismType' =&gt; 'телефон'])
        );

        $this-&gt;add(
            $formElementManager
                -&gt;get('Parties\Forms\Elements\CountrySelect')
        );

        $this-&gt;add(
            $formElementManager
                -&gt;get('Parties\Forms\Elements\ContactMechanismPurposeTypeMultiCheckbox',
                    ['mechanismType' =&gt; 'телефон'])
        );

        $this-&gt;add([
            'type' =&gt; 'text',
            'name' =&gt; 'areaCode',
            'attributes' =&gt; [
                'id' =&gt; 'area-code',
                'placeholder' =&gt; '1234',
            ],
            'options' =&gt; [
                'label' =&gt; 'Код области'
            ],
        ]);

        $this-&gt;add([
            'type' =&gt; 'text',
            'name' =&gt; 'phoneNbr',
            'attributes' =&gt; [
                'id' =&gt; 'phone-nbr',
                'placeholder' =&gt; '1234567890',
            ],
            'options' =&gt; [
                'label' =&gt; 'Номер телефона',
            ],
        ]);

        $this-&gt;add([
            'type' =&gt; 'text',
            'name' =&gt; 'extension',
            'attributes' =&gt; [
                'id' =&gt; 'extension',
                'placeholder' =&gt; '1234567890',
            ],
            'options' =&gt; [
                'label' =&gt; 'Добавочный',
            ],
        ]);

        $this-&gt;add([
            'type' =&gt; 'text',
            'name' =&gt; 'comment',
            'attributes' =&gt; [
                'id' =&gt; 'comment',
                'placeholder' =&gt; 'общий телефон организации',
            ],
            'options' =&gt; [
                'label' =&gt; 'Примечание',
            ],
        ]);

        return $this;
    }
}
</code></pre>