From e4e376ba28c142ed33d1763e78c8b6666f403b51 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sun, 24 Nov 2013 11:52:50 -0500 Subject: [PATCH] fixed test break. --- framework/yii/base/Model.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/framework/yii/base/Model.php b/framework/yii/base/Model.php index 502f696..06f0d1f 100644 --- a/framework/yii/base/Model.php +++ b/framework/yii/base/Model.php @@ -214,17 +214,13 @@ class Model extends Component implements IteratorAggregate, ArrayAccess } foreach ($scenarios as $scenario => $attributes) { - if (empty($attributes)) { + if (empty($attributes) && $scenario !== self::DEFAULT_SCENARIO) { unset($scenarios[$scenario]); } else { $scenarios[$scenario] = array_keys($attributes); } } - if (empty($scenarios[self::DEFAULT_SCENARIO])) { - // keep the default scenario so that models without any rules defined can work properly - $scenarios[self::DEFAULT_SCENARIO] = []; - } return $scenarios; }