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