mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 13:58:55 +08:00
Fix #18051: Fix missing support for custom validation method in EachValidator
This commit is contained in:
@ -8,6 +8,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #18019: Allow jQuery 3.5.0 to be installed (wouter90)
|
||||
- Bug #18026: Fix `ArrayHelper::getValue()` did not work with `ArrayAccess` objects (mikk150)
|
||||
- Enh #18048: Use `Instance::ensure()` to set `User::$accessChecker` (lav45)
|
||||
- Bug #18051: Fix missing support for custom validation method in EachValidator (bizley)
|
||||
|
||||
|
||||
2.0.35 May 02, 2020
|
||||
|
||||
@ -209,10 +209,13 @@ class Validator extends Component
|
||||
{
|
||||
$params['attributes'] = $attributes;
|
||||
|
||||
if ($type instanceof \Closure || ($model->hasMethod($type) && !isset(static::$builtInValidators[$type]))) {
|
||||
// method-based validator
|
||||
if ($type instanceof \Closure) {
|
||||
$params['class'] = __NAMESPACE__ . '\InlineValidator';
|
||||
$params['method'] = $type;
|
||||
} elseif (!isset(static::$builtInValidators[$type]) && $model->hasMethod($type)) {
|
||||
// method-based validator
|
||||
$params['class'] = __NAMESPACE__ . '\InlineValidator';
|
||||
$params['method'] = [$model, $type];
|
||||
} else {
|
||||
if (isset(static::$builtInValidators[$type])) {
|
||||
$type = static::$builtInValidators[$type];
|
||||
|
||||
Reference in New Issue
Block a user