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

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2 into remo…
Browse files Browse the repository at this point in the history
…ve-redundant-code
  • Loading branch information
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Hydrator/ClassMethods.php
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 990523c

Please sign in to comment.