Files
yii2/tests/data/validators/models/ValidatorTestEachAndInlineMethodModel.php
2022-08-03 12:32:18 +03:00

27 lines
653 B
PHP

<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\data\validators\models;
use yii\base\Model;
class ValidatorTestEachAndInlineMethodModel extends Model
{
public $arrayProperty = [true, false];
public function rules()
{
return [
['arrayProperty', 'each', 'rule' => [function ($attribute, $params, $validator) {
if (is_array($this->$attribute)) {
$this->addError($attribute, 'Each & Inline validators bug');
}
}]],
];
}
}