本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}