本文整理汇总了PHP中UserForm::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP UserForm::getErrors方法的具体用法?PHP UserForm::getErrors怎么用?PHP UserForm::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserForm
的用法示例。
在下文中一共展示了UserForm::getErrors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreateAdmin
/**
* This action enables us to create an admin user for CiiMS
*/
public function actionCreateAdmin()
{
$this->stage = Yii::app()->session['stage'] = 6;
$model = new UserForm();
if (Cii::get($_POST, 'UserForm') != NULL) {
$model->attributes = Cii::get($_POST, 'UserForm', array());
if ($model->save()) {
$this->redirect($this->createUrl('/admin'));
}
$errors = $model->getErrors();
$firstError = array_values($errors);
Yii::app()->user->setFlash('error', Yii::t('Install.main', '{{warning}} {{error}}', array('{{warning}}' => CHtml::tag('strong', array(), Yii::t('Install.main', 'Warning!')), '{{error}}' => $firstError[0][0])));
}
$this->render('createadmin', array('model' => $model));
}
示例2: addAction
public function addAction()
{
$form = new UserForm();
if ($form->isPosted()) {
if ($form->isValidForAdd()) {
$id = User::create(["email" => Input::get("email"), "password" => Hash::make(Input::get("password"))])->id;
$this->defaultGroup($id, 2);
return Redirect::route("user/profile");
}
return Redirect::route("user/add")->withInput(["email" => Input::get("email"), "errors" => $form->getErrors()]);
}
return View::make("user/add", ["form" => $form, "HeaderTitle" => "ADD USER"]);
}