本文整理匯總了PHP中Contacts::getErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Contacts::getErrors方法的具體用法?PHP Contacts::getErrors怎麽用?PHP Contacts::getErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Contacts
的用法示例。
在下文中一共展示了Contacts::getErrors方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createContact
private function createContact($con)
{
$con_model = new \Contacts();
$con_model->attributes = $con;
$con_model->ID_user = $this->tiUser->ID;
try {
if (!$con_model->save()) {
new \Error(5, null, json_encode($con_model->getErrors()));
}
} catch (Exception $e) {
new \Error(5, null, $e->getMessage());
}
}
示例2: actionQuickContact
/**
* Method of creating a Contact called by the Quick Create widget
*/
public function actionQuickContact()
{
$model = new Contacts();
// collect user input data
if (isset($_POST['Contacts'])) {
// clear values that haven't been changed from the default
//$temp=$model->attributes;
$model->setX2Fields($_POST['Contacts']);
$model->visibility = 1;
// validate user input and save contact
// $changes = $this->calculateChanges($temp, $model->attributes, $model);
// $model = $this->updateChangelog($model, $changes);
$model->createDate = time();
//if($model->validate()) {
if ($model->save()) {
} else {
//echo CHtml::errorSummary ($model);
echo CJSON::encode($model->getErrors());
}
return;
//}
//echo '';
//echo CJSON::encode($model->getErrors());
}
$this->renderPartial('application.components.views.quickContact', array('model' => $model));
}