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

Commit

Permalink
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/Hydrator/ClassMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,7 @@ public function extract($object)
$attribute = preg_replace_callback('/([A-Z])/', $transform, $attribute);
}

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

// 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;
$attributes[$attribute] = $object->$method();
}
}

Expand Down

0 comments on commit b8398c0

Please sign in to comment.