Zend\Form\Form has to override getHydrator() method as setHydrator(..) is. #2661

Closed
eimanavicius opened this Issue Oct 3, 2012 · 3 comments

Projects

None yet

2 participants

@eimanavicius

Fieldset (set as base fieldset) has ClassMethodsHydrator but if call getHydrator on Form that hydrator is changed to default one.

http://pastie.org/private/lsnyegz51556w7iay9az9g

I think overridden getHydrator() should look like:

public function getHydrator() {
        if ($this->baseFieldset !== null) {
            return $this->baseFieldset->getHydrator();
        }
        return parent::getHydrator();
}
@ThaDafinser

@Hamlis i think this cannot be done.

Simple reason: Fieldset and form can be "independent" so in the Form you can also have a own hydrator and own elements...(also Form extends Fieldset...so it's partly a "fieldset")

If it's okay for you -> can this get closed?

@eimanavicius

I agree with you "Fieldset and form can be "independent"", but then:

$form->setHydrator($hydrator);
$hydrator != $form->getHydrator()

setHydrator should not be overrided to set hydrator for baseFieldset

@eimanavicius

This issue can be closed. I did not tracked when the change was made, but now hydrator setters and getters works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment