yupe\components\validators\YRequiredValidator::validateAttribute PHP Метод

validateAttribute() защищенный Метод

protected validateAttribute ( CModel $object, string $attribute )
$object CModel
$attribute string
    protected function validateAttribute($object, $attribute)
    {
        $value = $object->{$attribute};
        if ($this->allowEmpty && $this->isEmpty($value)) {
            return;
        }
        if ($this->requiredValue !== null) {
            if (!$this->strict && $value != $this->requiredValue || $this->strict && $value !== $this->requiredValue) {
                $message = $this->message !== null ? $this->message : Yii::t('YupeModule.yupe', '{attribute} must be {value}', ['{value}' => $this->requiredValue]);
                $this->addError($object, $attribute, $message);
            }
        } elseif ($this->isEmpty($value, true)) {
            $message = $this->message !== null ? $this->message : Yii::t('YupeModule.yupe', '{attribute} cannot be blank');
            $this->addError($object, $attribute, $message);
        }
    }
YRequiredValidator