mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-20 18:32:59 +08:00
fixed test break.
This commit is contained in:
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user