Skip to content

Commit

Permalink
Fix for an earlier assumption that the API didn't return more than tw…
Browse files Browse the repository at this point in the history
…o levels of nested objects.
  • Loading branch information
calcinai committed May 1, 2015
1 parent 3c6108f commit ef9dc11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/XeroPHP/Remote/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace XeroPHP\Remote;

use XeroPHP\Exception;
use XeroPHP\Helpers;

/**
* Class Object
Expand Down Expand Up @@ -116,7 +117,9 @@ public function fromStringArray($input_array, $replace_data = false) {
if(!isset($input_array[$property]))
continue;

if(is_array($input_array[$property])) {
//Fix for an earlier assumption that the API didn't return more than two levels of nested objects.
//Handles Invoice > Contact > Address etc. in one build.
if(is_array($input_array[$property]) && Helpers::isAssoc($input_array[$property]) === false) {
$this->_data[$property] = array();
foreach($input_array[$property] as $assoc_element) {
$this->_data[$property][] = self::castFromString($type, $assoc_element, $php_type);
Expand Down

0 comments on commit ef9dc11

Please sign in to comment.