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/one-to-many' of https://github.com/bakura10/zf2
Browse files Browse the repository at this point in the history
…into feature/form-options-one-to-many
  • Loading branch information
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Hydrator/ClassMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@ public function extract($object)

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

// Recursively extract if object contains itself other objects
// Recursively extract if object contains itself other objects or arrays of objects
if (is_object($result)) {
$result = $this->extract($result);
} elseif (is_array($result)) {
foreach ($result as $key => $value) {
if (is_object($value)) {
$result[$key] = $this->extract($value);
}
}
}

$attributes[$attribute] = $result;
Expand Down

0 comments on commit 3ea7087

Please sign in to comment.