Skip to content

Instantly share code, notes, and snippets.

@zluiten
Created August 14, 2012 14:06
Show Gist options
  • Save zluiten/3349535 to your computer and use it in GitHub Desktop.
Save zluiten/3349535 to your computer and use it in GitHub Desktop.
Set hydrator recursive
public class someForm extends Form {
public function setHydrator(\Zend\Stdlib\Hydrator\HydratorInterface $hydrator) {
parent::setHydrator($hydrator);
$this->setHydratorRecursive($hydrator, $this);
}
protected function setHydratorRecursive($hydrator, $fieldset) {
$nextfieldsets = $fieldset->getFieldsets();
foreach ($nextfieldsets as $nextfieldset) {
$nextfieldset->setHydrator($hydrator);
$this->setHydratorRecursive($hydrator, $nextfieldset);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment