mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Fixes #4736
This commit is contained in:
@ -102,12 +102,8 @@ class BlameableBehavior extends AttributeBehavior
|
|||||||
protected function getValue($event)
|
protected function getValue($event)
|
||||||
{
|
{
|
||||||
if ($this->value === null) {
|
if ($this->value === null) {
|
||||||
if (Yii::$app->hasMethod('getUser')) {
|
$user = Yii::$app->get('user', false);
|
||||||
$user = Yii::$app->getUser();
|
|
||||||
return $user && !$user->isGuest ? $user->id : null;
|
return $user && !$user->isGuest ? $user->id : null;
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return call_user_func($this->value, $event);
|
return call_user_func($this->value, $event);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user