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