本文整理匯總了PHP中CFormModel::rules方法的典型用法代碼示例。如果您正苦於以下問題:PHP CFormModel::rules方法的具體用法?PHP CFormModel::rules怎麽用?PHP CFormModel::rules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CFormModel
的用法示例。
在下文中一共展示了CFormModel::rules方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rules
/**
* Validation rules
*
* @see CModel::rules()
*
* @return array
*/
public function rules()
{
$rules = parent::rules();
$rules[] = array('amount', 'in', 'range' => range(0, 10000));
$rules[] = array('id_bank', 'safe');
return $rules;
}
示例2: rules
/**
* Validation rules
*
* @see CModel::rules()
*
* @return array
*/
public function rules()
{
$rules = parent::rules();
$rules[] = array('email', 'email');
$rules[] = array('email', 'unique');
return $rules;
}
示例3: rules
/**
* Declares the validation rules.
* The rules state that username and password are required,
* and password needs to be authenticated.
*/
public function rules()
{
return array_merge(parent::rules(), array(array('username, password', 'required'), array('rememberMe', 'boolean'), array('password', 'authenticate')));
}
示例4: rules
public function rules()
{
return array_merge(parent::rules(), array(array('userMembershipData', 'safe'), array('userNonMembershipData', 'safe')));
}
示例5: rules
public function rules()
{
$rules = parent::rules();
return array_merge($rules, array(array('password, password_check', 'length', 'max' => 128, 'min' => 6, 'message' => 'Incorrect password (minimal length 6 symbols).'), array('password_check', 'compare', 'compareAttribute' => 'password', 'message' => "Retype Password is incorrect.")));
}
示例6: rules
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array_merge(parent::rules(), [['email, username', 'safe'], ['email, username', 'required'], ['email', 'length', 'max' => 255], ['password', 'length', 'min' => 6, 'max' => 128], ['username', 'length', 'min' => 3, 'max' => 20], ['username', 'match', 'pattern' => '/^[A-Za-z0-9_\\-\\.]+$/u', 'message' => 'Username can contain only alphanumeric characters, dot (.) and hyphens (-).']]);
}