From 930d3dcb9fb47f80268d38fa36c68d32a349e4e7 Mon Sep 17 00:00:00 2001 From: evgen-d Date: Fri, 12 Sep 2014 16:32:03 +0400 Subject: [PATCH] set default values only on default scenario --- ActiveRecord.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ActiveRecord.php b/ActiveRecord.php index 694c28c..82da5ea 100644 --- a/ActiveRecord.php +++ b/ActiveRecord.php @@ -394,7 +394,9 @@ abstract class ActiveRecord extends BaseActiveRecord public function init() { parent::init(); - $this->setAttributes($this->defaultValues(), false); + if ($this->scenario === static::SCENARIO_DEFAULT) { + $this->setAttributes($this->defaultValues(), false); + } } public function defaultValues()