mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
refactored validators.
This commit is contained in:
@ -245,8 +245,9 @@ abstract class Validator extends Component
|
||||
*/
|
||||
public function addError($object, $attribute, $message, $params = array())
|
||||
{
|
||||
$value = $object->$attribute;
|
||||
$params['{attribute}'] = $object->getAttributeLabel($attribute);
|
||||
$params['{value}'] = $object->$attribute;
|
||||
$params['{value}'] = is_array($value) ? 'array()' : $value;
|
||||
$object->addError($attribute, strtr($message, $params));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user