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

Commit

Permalink
Merge branch 'feature/form-hydrator' of https://github.com/bakura10/zf2
Browse files Browse the repository at this point in the history
… into feature/form-fieldset-hydration

Conflicts:
	library/Zend/Form/Fieldset.php
	library/Zend/Form/Form.php
  • Loading branch information
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Hydrator/ClassMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,15 @@ public function extract($object)
if (!$this->useCamelCase) {
$attribute = preg_replace_callback('/([A-Z])/', $transform, $attribute);
}
$attributes[$attribute] = $object->$method();

$result = $object->$method();

// Recursively extract if object contains itself other objects
if (is_object($result)) {
$result = $this->extract($result);
}

$attributes[$attribute] = $result;
}
}

Expand Down Expand Up @@ -115,6 +123,7 @@ public function hydrate(array $data, $object)
$letter = substr(array_shift($letters), 1, 1);
return ucfirst($letter);
};

foreach ($data as $property => $value) {
if (!$this->useCamelCase) {
$property = preg_replace_callback('/(_[a-z])/', $transform, $property);
Expand Down

0 comments on commit 0fe3d3a

Please sign in to comment.