protected function getUserId() { return Yii::$app instanceof Application && Yii::$app->user ? Yii::$app->user->id : null; }