Skip to content

Commit

Permalink
Merge pull request #253 from mercadopago/hotfix/SDKMP-185
Browse files Browse the repository at this point in the history
Fix issue #251
  • Loading branch information
Pedro Gonçalves authored Mar 24, 2020
2 parents 0986581 + 84314a0 commit 2364d6b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/MercadoPago/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,17 +470,19 @@ protected function _fillFromArray($entity, $data)
if ($data) {

foreach ($data as $key => $value) {
if (is_array($value)) {
$className = 'MercadoPago\\' . $this->_camelize($key);
if (class_exists($className, true)) {
$entity->_setValue($key, new $className, false);
$entity->_fillFromArray($this->{$key}, $value);
} else {
$entity->_setValue($key, json_decode(json_encode($value)), false);
if (!is_null($value)){
if (is_array($value)) {
$className = 'MercadoPago\\' . $this->_camelize($key);
if (class_exists($className, true)) {
$entity->_setValue($key, new $className, false);
$entity->_fillFromArray($this->{$key}, $value);
} else {
$entity->_setValue($key, json_decode(json_encode($value)), false);
}
continue;
}
continue;
$entity->_setValue($key, $value, false);
}
$entity->_setValue($key, $value, false);
}
}
}
Expand Down

0 comments on commit 2364d6b

Please sign in to comment.