public function addError($model, $attribute, $message, $params = [])
    {
        $value = $model->$attribute;
        $params['attribute'] = $model->getAttributeLabel($attribute);
        $params['value'] = is_array($value) ? 'array()' : $value;
        $model->addError($attribute, Yii::$app->getI18n()->format($message, $params, Yii::$app->language));
    }
public function addError($model, $attribute, $message, $params = [])
    {
        $value = $model->$attribute;
        $params['attribute'] = $model->getAttributeLabel($attribute);
        $params['value'] = is_array($value) ? 'array()' : $value;
        $model->addError($attribute, Yii::$app->getI18n()->format($message, $params, Yii::$app->language));
    }
public function addError ( $ model , $ attribute , $ message , $ params = [ ] ) { $ value = $ model -> $ attribute ; $ params [ 'attribute' ] = $ model -> getAttributeLabel ( $ attribute ) ; $ params [ 'value' ] = is_array ( $ value ) ? 'array()' : $ value ; $ model -> addError ( $ attribute , Yii :: $ app -> getI18n ( ) -> format ( $ message , $ params , Yii :: $ app -> language ) ) ; }
Adds an error about the specified attribute to the model object.
This is a helper method that performs message selection and internationalization.
@param \yii\base\Model $model the data model being validated
@param string $attribute the attribute being validated
@param string $message the error message
@param array $params values for the placeholders in the error message
Adds an error about the specified attribute to the model object . This is a helper method that performs message selection and internationalization .