set default values only on default scenario

This commit is contained in:
evgen-d 2014-09-12 16:32:03 +04:00
parent 92f2dbb4fe
commit 930d3dcb9f

View File

@ -394,8 +394,10 @@ abstract class ActiveRecord extends BaseActiveRecord
public function init() public function init()
{ {
parent::init(); parent::init();
if ($this->scenario === static::SCENARIO_DEFAULT) {
$this->setAttributes($this->defaultValues(), false); $this->setAttributes($this->defaultValues(), false);
} }
}
public function defaultValues() public function defaultValues()
{ {