Commit e4e376ba by Qiang Xue

fixed test break.

parent 858326c0
...@@ -214,17 +214,13 @@ class Model extends Component implements IteratorAggregate, ArrayAccess ...@@ -214,17 +214,13 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
} }
foreach ($scenarios as $scenario => $attributes) { foreach ($scenarios as $scenario => $attributes) {
if (empty($attributes)) { if (empty($attributes) && $scenario !== self::DEFAULT_SCENARIO) {
unset($scenarios[$scenario]); unset($scenarios[$scenario]);
} else { } else {
$scenarios[$scenario] = array_keys($attributes); $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; return $scenarios;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment