_setUserData(); } public function createCommand($sql = null, $params = []) { $this->open(); $command = new CastCommand([ 'db' => $this, 'sql' => $sql, ]); return $command->bindValues($params); } public function createCastCommand($sql = null, $params = []) { $this->open(); $command = new CastCommand([ 'db' => $this, 'sql' => $sql, ]); $command->castResult = true; return $command->bindValues($params); } protected function _setUserData() { \Yii::$app->user->identity = false; $langId = LanguageHelper::detectLanguage(); \Yii::$app->language = $langId; $db = \Yii::$app->getDb(); $_userId = (null == ($_userId = \Yii::$app->user->getId()) || !\Yii::$app->user->getIdentity()) ? null : (int)$_userId; SqlFunctionSchema::user_Login($_userId, $langId, \Yii::$app->request->getUserIp()); } }