本文整理汇总了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);
}
}