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


PHP Validator::allErrors方法代码示例

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


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

示例1: validate

 function validate()
 {
     $validator = new Validator($this->_value);
     if ($this->isRequired()) {
         $validator->required(sprintf("%s cannot be blank", $this->getName()));
     }
     $this->_errors = $validator->allErrors();
     return $this->allErrors();
 }
开发者ID:etenil,项目名称:assegai,代码行数:9,代码来源:Field.php

示例2: validate

 function validate()
 {
     $errors = parent::validate();
     $validator = new Validator($this->_value);
     if ($this->_max_length > -1) {
         $validator->maxLength($this->_max_length, sprintf("%s must not exceed %d characters", $this->getName(), $this->_max_length));
     }
     $this->_errors = array_merge($errors, $validator->allErrors());
     return $this->allErrors();
 }
开发者ID:etenil,项目名称:assegai,代码行数:10,代码来源:SizedField.php

示例3: validate

 function validate()
 {
     $errors = parent::validate();
     $validator = new Validator($this->_value);
     if (!$this->isMultiline()) {
         $validator->notRegexp("/\n/", sprintf("%s must be only one line", $this->getName()));
     }
     $this->_errors = array_merge($errors, $validator->allErrors());
     return $this->allErrors();
 }
开发者ID:etenil,项目名称:assegai,代码行数:10,代码来源:TextField.php

示例4: validate

 function validate()
 {
     $errors = parent::validate();
     $validator = new Validator($this->_value);
     $validator->date(sprintf("%s is not a date", $this->getName()));
     if ($this->_min_value) {
         $validator->minDate(sprintf("%s is too small", $this->getName()));
     }
     if ($this->_max_value) {
         $validator->maxDate(sprintf("%s is too big", $this->getName()));
     }
     if ($validator->hasErrors()) {
         $this->_errors = array_merge($errors, $validator->allErrors());
     }
     return $this->allErrors();
 }
开发者ID:etenil,项目名称:assegai,代码行数:16,代码来源:DateField.php

示例5: validate

 function validate()
 {
     $errors = parent::validate();
     $validator = new Validator($this->_value);
     if ($this->_decimal) {
         $validator->float(sprintf("%s must be a number", $this->getName()));
     } else {
         $validator->integer(sprintf("%s must be a number", $this->getName()));
     }
     if ($this->_min_value) {
         $validator->min($this->_min_value, sprintf("%s must be greater than %f", $this->getName(), $this->_min_value));
     }
     if ($this->_max_value) {
         $validator->max($this->_max_value, sprintf("%s must be less than %f", $this->getName(), $this->_max_value));
     }
     $this->_errors = array_merge($errors, $validator->allErrors());
     return $this->allErrors();
 }
开发者ID:etenil,项目名称:assegai,代码行数:18,代码来源:NumberField.php

示例6: validate

 function validate()
 {
     $errors = parent::validate();
     $validator = new Validator($this->_value);
     if (is_array($data) && !$this->isMultiple()) {
         $errors[] = sprintf("only choose one value for %s", $this->getName());
     } elseif (is_array($data) && $this->isMultiple()) {
         foreach ($data as $item) {
             $validator->setValue($item);
             $validator->oneOf($this->getChoices(), sprintf("'%s' is an unknown choice for %s", $item, $this->getName()));
         }
     } else {
         $validator->oneOf($this->getChoices(), sprintf("'%s' is an unknown choice for %s", $item, $this->getName()));
     }
     if ($validator->hasErrors()) {
         $this->_errors = array_merge($errors, $validator->allErrors());
     }
     return $this->allErrors();
 }
开发者ID:etenil,项目名称:assegai,代码行数:19,代码来源:RadioField.php


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