Skip to content

Commit

Permalink
Rewrite method for hydrateCollection with ,
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Aug 16, 2014
1 parent c30425f commit d9e3960
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function getUsers(array $ids)
'uids' => $ids
));

return $this->hydrateUsersCollection($apiResult);
return $this->hydrateCollection($apiResult, $this->getHydrator(), new Entity\User());
}

/**
Expand All @@ -189,15 +189,17 @@ public function getFriendsList($id = null)

/**
* @param $apiResult
* @param $hydrator
* @param $instance
* @return array|bool
*/
protected function hydrateUsersCollection($apiResult)
protected function hydrateCollection($apiResult, $hydrator, $instance)
{
if ($apiResult && is_array($apiResult)) {
$result = array();

foreach ($apiResult as $row) {
$result[] = $this->getHydrator()->hydrate(new Entity\User(), $result);
$result[] = $hydrator->hydrate($instance, $result);
}

return $result;
Expand Down

0 comments on commit d9e3960

Please sign in to comment.