Commit ce6f33af by Qiang Xue

Fixes #4736

parent 3b705855
......@@ -102,12 +102,8 @@ class BlameableBehavior extends AttributeBehavior
protected function getValue($event)
{
if ($this->value === null) {
if (Yii::$app->hasMethod('getUser')) {
$user = Yii::$app->getUser();
return $user && !$user->isGuest ? $user->id : null;
} else {
return null;
}
$user = Yii::$app->get('user', false);
return $user && !$user->isGuest ? $user->id : null;
} else {
return call_user_func($this->value, $event);
}
......
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