Skip to content

Commit

Permalink
personservice findFriends fix
Browse files Browse the repository at this point in the history
  • Loading branch information
erkkki committed Feb 20, 2013
1 parent 001b481 commit ce1f4a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Losofacebook/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getFriends()
/**
* @param array $friends
*/
public function setFriends(array $friends)
public function setFriends($friends)
{
$this->friends = $friends;
}
Expand Down
9 changes: 3 additions & 6 deletions src/Losofacebook/Service/PersonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,11 @@ public function findBy(array $params = [], $options = [], $fetchFriends = true)
return $this->createPerson($data, $fetchFriends);
});
}

public function findFriends($id)
{
$friends = [];
foreach ($this->findFriendIds($id) as $friendId) {
$friends[] = $this->findById($friendId, false);
}

return $friends;
return $this->findBy(['id' => $this->findFriendIds($id)], [], false);

}

/**
Expand Down

0 comments on commit ce1f4a0

Please sign in to comment.