/** * Override to properly handle retrieving rule information from the model for the attribute name. * Will also pull required rules if the scenario calls for it. */ public function rules() { if ($this->getScenario() == 'extraColumn') { $requiredRuleIsApplicable = true; } else { $requiredRuleIsApplicable = false; } $defaultValueApplicableModelAttributeRules = ModelAttributeRulesToDefaultValueMappingRuleUtil::getApplicableRulesByModelClassNameAndAttributeName($this->modelClassName, $this->modelAttributeName, static::getAttributeName(), $requiredRuleIsApplicable); return array_merge(parent::rules(), $defaultValueApplicableModelAttributeRules); }
public function __construct($modelClassName, $modelAttributeName) { parent::__construct($modelClassName, $modelAttributeName); $this->rateToBase = 1; }
public function __construct($modelClassName, $modelAttributeName) { parent::__construct($modelClassName, $modelAttributeName); assert('Yii::app()->user->userModel != null'); $this->id = Yii::app()->user->userModel->currency->id; }