protected function _loadJobResultData($resultObject)
{
$item = new JobResultData();
$properties = get_object_vars($item);
foreach ($properties as $property => $value) {
if (property_exists($resultObject, "{$property}")) {
if ('created' == $property) {
$item->created = new DateTime((string) $resultObject->created, new DateTimeZone('UTC'));
} else {
if (is_object($resultObject->{$property})) {
trigger_error('Cloudstack error. Unexpected stdObject class received in property: ' . $property . ', value: ' . json_encode($resultObject->{$property}), E_USER_WARNING);
$item->{$property} = json_encode($resultObject->{$property});
} else {
$item->{$property} = (string) $resultObject->{$property};
}
}
}
}
if (property_exists($resultObject, 'jobresult') && property_exists($resultObject->jobresult, 'virtualmachine')) {
$item->setVirtualmachine($this->_loadVirtualMachineInstanceData($resultObject->jobresult->virtualmachine));
}
if (property_exists($resultObject, 'jobresult') && property_exists($resultObject->jobresult, 'errorcode') && property_exists($resultObject->jobresult, 'errortext')) {
$item->errorcode = $resultObject->jobresult->errorcode;
$item->errortext = $resultObject->jobresult->errortext;
}
return $item;
}