Skip to content

Commit

Permalink
Don't try to parse body when passing in array. Fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
haugstrup committed Jan 24, 2013
1 parent 19f7024 commit 4077594
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/PodioObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ protected function set_attribute($name, $value) {
throw new Exception("Attribute cannot be assigned. Property '{$name}' doesn't exist.");
}

public static function listing($response) {
if ($response) {
$body = $response->json_body();
public static function listing($response_or_attributes) {
if ($response_or_attributes) {
if (is_object($response_or_attributes) && get_class($response_or_attributes) == 'PodioResponse') {
$body = $response_or_attributes->json_body();
}
else {
$body = $response_or_attributes;
}
$list = array();
foreach ($body as $attributes) {
$class_name = get_called_class();
Expand Down

0 comments on commit 4077594

Please sign in to comment.