当前位置: 首页>>代码示例>>PHP>>正文


PHP Validator::notEmpty方法代码示例

本文整理汇总了PHP中Cake\Validation\Validator::notEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::notEmpty方法的具体用法?PHP Validator::notEmpty怎么用?PHP Validator::notEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Validation\Validator的用法示例。


在下文中一共展示了Validator::notEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->integer('id')->allowEmpty('id', 'create');
     $validator->notEmpty('username', 'A username is required');
     $validator->notEmpty('password', 'A password is required');
     return $validator;
 }
开发者ID:KimiyukiYamauchi,项目名称:phppro.2015,代码行数:13,代码来源:UsersTable.php

示例2: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->notEmpty('title')->requirePresence('title');
     $validator->notEmpty('description');
     $validator->notEmpty('content')->requirePresence('content');
     return $validator;
 }
开发者ID:hack3rlov3,项目名称:cakephptutorial,代码行数:13,代码来源:ArticlesTable.php

示例3: _buildValidation

 public function _buildValidation(Validator $validator)
 {
     $validator->add('mensagem', ['minLength' => ['rule' => ['minLength', 10], 'message' => 'A mensagem precisa ter pelo menos 10 letras']]);
     $validator->notEmpty('nome');
     $validator->notEmpty('email');
     return $validator;
 }
开发者ID:rafaelschn,项目名称:cake3lab,代码行数:7,代码来源:ContatoForm.php

示例4: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->notEmpty('title');
     $validator->notEmpty('body');
     return $validator;
 }
开发者ID:jeffblack360,项目名称:cakeblog,代码行数:13,代码来源:ArticlesTable.php

示例5: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->notEmpty('username', 'Username is required');
     $validator->notEmpty('password', 'Password is required');
     $validator->notEmpty('role', 'Role is required')->add('role', 'inList', ['rule' => ['inList', ['admin', 'author']], 'message' => ' Please enter a valid role']);
     return $validator;
 }
开发者ID:hack3rlov3,项目名称:cakephptutorial,代码行数:13,代码来源:UsersTable.php

示例6: _buildValidator

 protected function _buildValidator(Validator $validator)
 {
     $validator->notEmpty('nome');
     $validator->notEmpty('email');
     $validator->notEmpty('msg');
     $validator->add('msg', ["minLength" => ["rule" => ['minLength', 10], "message" => "A mensagem deve ter pelo menos 10 letras"]]);
     return $validator;
 }
开发者ID:rsaggio,项目名称:curso-cakephp,代码行数:8,代码来源:ContactForm.php

示例7: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->add('email', 'valid', ['rule' => 'email'])->requirePresence('email', 'create')->notEmpty('email');
     $validator->notEmpty('username');
     $validator->requirePresence('password', 'create')->notEmpty('password');
     $validator->notEmpty('role', 'A role is required')->add('role', 'inList', ['rule' => ['inList', ['admin', 'user']], 'message' => 'Please enter a valid role']);
     return $validator;
 }
开发者ID:webroup17,项目名称:social_networking,代码行数:15,代码来源:UsersTable.php

示例8: validationDefault

 /**
  * Default user validation.
  *
  * @param Validator $validator
  * @return Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->notEmpty('role_id', __d('community', 'Please, chose user role.'))->notEmpty('name', __d('community', 'Please, enter you name.'));
     $validator->notEmpty('username', __d('community', 'Username could not be empty.'))->add('username', 'unique', ['provider' => 'table', 'rule' => 'validateUnique', 'message' => __d('community', 'User with this login already exists.')]);
     $validator->notEmpty('email', __d('community', 'Email could not be empty.'))->add('email', 'unique', ['provider' => 'table', 'rule' => 'validateUnique', 'message' => __d('community', 'User with this email already exists.')])->add('email', 'valid', ['rule' => 'email', 'message' => __d('community', 'Please enter valid email.')]);
     $validator->notEmpty('password', __d('community', 'Please, enter you password.'))->add('password', 'minLength', ['rule' => ['minLength', $this->_passMinLength], 'message' => __d('community', 'The minimum password length is {0}', $this->_passMinLength)]);
     $validator->notEmpty('password_confirm', __d('community', 'Please, confirm you password.'))->add('password_confirm', 'no-misspelling', ['rule' => ['compareWith', 'password'], 'message' => __d('community', 'Passwords are not equal')]);
     return $validator;
 }
开发者ID:Cheren,项目名称:union,代码行数:15,代码来源:UsersTable.php

示例9: validationDefault

 public function validationDefault(Validator $validator)
 {
     $validator->notEmpty('attribute_id');
     $validator->notEmpty('item_id');
     $validator->add('attribute_id', 'valid', ['rule' => 'numeric']);
     $validator->add('item_id', 'valid', ['rule' => 'numeric']);
     $validator->requirePresence('attribute_id', 'create');
     $validator->requirePresence('item_id', 'create');
     return $validator;
 }
开发者ID:pwerken,项目名称:va-void,代码行数:10,代码来源:AttributesItemsTable.php

示例10: validationDefault

 public function validationDefault(Validator $validator)
 {
     $validator->allowEmpty('id', 'create');
     $validator->notEmpty('player_id');
     $validator->notEmpty('chin');
     $validator->notEmpty('name');
     $validator->notEmpty('xp');
     $validator->notEmpty('faction_id');
     $validator->notEmpty('belief_id');
     $validator->notEmpty('group_id');
     $validator->notEmpty('world_id');
     $validator->allowEmpty('soulpath');
     $validator->notEmpty('status');
     $validator->allowEmpty('comments');
     $validator->add('id', 'valid', ['rule' => 'numeric']);
     $validator->add('player_id', 'valid', ['rule' => 'numeric']);
     $validator->add('chin', 'valid', ['rule' => 'naturalNumber']);
     $validator->add('xp', 'valid', ['rule' => ['custom', '/^[0-9]*([\\.][05])?$/']]);
     $validator->add('faction_id', 'valid', ['rule' => 'numeric']);
     $validator->add('belief_id', 'valid', ['rule' => 'numeric']);
     $validator->add('group_id', 'valid', ['rule' => 'numeric']);
     $validator->add('world_id', 'valid', ['rule' => 'numeric']);
     $validator->add('soulpath', 'valid', ['rule' => ['inList', Character::soulpathValues()]]);
     $validator->add('status', 'valid', ['rule' => ['inList', Character::statusValues()]]);
     $validator->requirePresence('player_id', 'create');
     $validator->requirePresence('chin', 'create');
     $validator->requirePresence('name', 'create');
     return $validator;
 }
开发者ID:pwerken,项目名称:va-void,代码行数:29,代码来源:CharactersTable.php

示例11: validationDefault

 public function validationDefault(Validator $validator)
 {
     $validator->allowEmpty('id', 'create');
     $validator->notEmpty('name');
     $validator->notEmpty('player_text');
     $validator->allowEmpty('cs_text');
     $validator->add('id', 'valid', ['rule' => 'numeric']);
     $validator->requirePresence('name', 'create');
     $validator->requirePresence('player_text', 'create');
     return $validator;
 }
开发者ID:pwerken,项目名称:va-void,代码行数:11,代码来源:ConditionsTable.php

示例12: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  *
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->requirePresence('presentation', 'create')->notEmpty('presentation');
     $validator->add('weeklyHours', 'valid', ['rule' => 'numeric'])->requirePresence('weeklyHours', 'create')->notEmpty('weeklyHours');
     $validator->add('startDate', 'valid', ['rule' => 'date'])->requirePresence('startDate', 'create')->notEmpty('startDate');
     $validator->add('endDate', 'valid', ['rule' => 'date'])->requirePresence('endDate', 'create')->notEmpty('endDate');
     $validator->notEmpty('accepted');
     $validator->notEmpty('archived');
     return $validator;
 }
开发者ID:jenwei,项目名称:Website,代码行数:18,代码来源:ApplicationsTable.php

示例13: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('iduser', 'valid', ['rule' => 'numeric'])->allowEmpty('iduser');
     $validator->add('idAnn', 'valid', ['rule' => 'numeric'])->allowEmpty('idAnn', 'create');
     $validator->notEmpty('titre');
     $validator->notEmpty('cat');
     $validator->notEmpty('lieu');
     $validator->add('prix', 'valid', ['rule' => 'numeric'])->notEmpty('prix');
     $validator->add('image', 'valid', ['rule' => ['mimeType', ['image/jpeg', 'image/png']], 'message' => __('Jpg ou PNG uniquement')])->notEmpty('image');
     $validator->notEmpty('description');
     return $validator;
 }
开发者ID:JoHein,项目名称:LeBonCoup,代码行数:18,代码来源:AnnoncesTable.php

示例14: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->allowEmpty('group');
     $validator->add('admin', 'valid', ['rule' => 'boolean'])->allowEmpty('admin');
     $validator->allowEmpty('manager');
     $validator->notEmpty('username', 'Username is required');
     $validator->add('holiday', 'valid', ['rule' => 'numeric'])->allowEmpty('holiday');
     $validator->add('rem_holiday', 'valid', ['rule' => 'numeric'])->allowEmpty('rem_holiday');
     $validator->notEmpty('password', 'Password is required');
     return $validator;
 }
开发者ID:zoparga,项目名称:szakdoga,代码行数:18,代码来源:UsersTable.php

示例15: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->notEmpty('firstname', 'Please fill this field');
     $validator->notEmpty('lastname', 'Please fill this field');
     $validator->add('email', 'valid', ['rule' => 'email'])->notEmpty('email', 'Please fill this field');
     $validator->requirePresence('password', 'create')->add('password', ['length' => ['rule' => ['minLength', 8], 'message' => 'Password need to be at least 8 characters long'], 'letter' => ['rule' => ['custom', '/[a-z]+/'], 'message' => 'Password need to be at least one lowercase letter'], 'capital' => ['rule' => ['custom', '/[A-Z]+/'], 'message' => 'Password need to be at least one uppercase  letter'], 'number' => ['rule' => ['custom', '/[0-9]+/'], 'message' => 'Password need to be at least one number']])->notEmpty('password', 'Please fill password');
     $validator->add('is_active', 'valid', ['rule' => 'boolean'])->allowEmpty('is_active');
     $validator->allowEmpty('role');
     $validator->add('last_login', 'valid', ['rule' => 'datetime'])->allowEmpty('last_login');
     return $validator;
 }
开发者ID:hongtien510,项目名称:cakephp-routing,代码行数:18,代码来源:UsersTable.php


注:本文中的Cake\Validation\Validator::notEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。