public static model ( $className = __CLASS__ ) : Attribute | ||
return | Attribute | the static model class |
public static function model($className = __CLASS__)
{
return parent::model($className);
}
public function beforeValidate() { if ($this->attribute_option_id) { $option = AttributeOption::model()->findByPk($this->attribute_option_id); $this->attribute_value = $option ? $option->value : null; } if (!$this->attribute_value) { $this->addErrors(['attribute_value' => Yii::t('StoreModule.store', 'You must specify the attribute value')]); } return parent::beforeValidate(); }