當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Institution::GetValidationErrors方法代碼示例

本文整理匯總了PHP中Institution::GetValidationErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Institution::GetValidationErrors方法的具體用法?PHP Institution::GetValidationErrors怎麽用?PHP Institution::GetValidationErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Institution的用法示例。


在下文中一共展示了Institution::GetValidationErrors方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Create

 /**
  * API Method inserts a new Institution record and render response as JSON
  */
 public function Create()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $institution = new Institution($this->Phreezer);
         // TODO: any fields that should not be inserted by the user should be commented out
         // this is an auto-increment.  uncomment if updating is allowed
         // $institution->Idinstitution = $this->SafeGetVal($json, 'idinstitution');
         $institution->Name = $this->SafeGetVal($json, 'name');
         $institution->Description = $this->SafeGetVal($json, 'description');
         $institution->Uri = $this->SafeGetVal($json, 'uri');
         $institution->Otherinformation = $this->SafeGetVal($json, 'otherinformation');
         $institution->Code = $this->SafeGetVal($json, 'code');
         $institution->Timezone = $this->SafeGetVal($json, 'timezone');
         $institution->Thumbnail = $this->SafeGetVal($json, 'thumbnail');
         $institution->Validate();
         $errors = $institution->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $institution->Save();
             $this->RenderJSON($institution, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
開發者ID:arianestolfi,項目名稱:digital,代碼行數:33,代碼來源:InstitutionController.php


注:本文中的Institution::GetValidationErrors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。