當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。