public static function FromJSON($oJson) { if (!isset($oJson->items)) { throw new Exception("Missing 'items' elements"); } $oCaseLog = new ormCaseLog(); foreach ($oJson->items as $oItem) { $oCaseLog->AddLogEntryFromJSON($oItem); } return $oCaseLog; }
public function MakeRealValue($proposedValue, $oHostObj) { if ($proposedValue instanceof ormCaseLog) { // Passthrough $ret = $proposedValue; } else { // Append the new value if an instance of the object is supplied // $oPreviousLog = null; if ($oHostObj != null) { $oPreviousLog = $oHostObj->Get($this->GetCode()); if (!is_object($oPreviousLog)) { $oPreviousLog = $oHostObj->GetOriginal($this->GetCode()); } } if (is_object($oPreviousLog)) { $oCaseLog = clone $oPreviousLog; } else { $oCaseLog = new ormCaseLog(); } if ($proposedValue instanceof stdClass) { $oCaseLog->AddLogEntryFromJSON($proposedValue); } else { if (strlen($proposedValue) > 0) { $oCaseLog->AddLogEntry(parent::MakeRealValue($proposedValue, $oHostObj)); } } $ret = $oCaseLog; } return $ret; }