當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::className方法代碼示例

本文整理匯總了PHP中frontend\models\User::className方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::className方法的具體用法?PHP User::className怎麽用?PHP User::className使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在frontend\models\User的用法示例。


在下文中一共展示了User::className方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 /** @inheritdoc */
 public function init()
 {
     $this->user = \Yii::createObject(['class' => User::className(), 'scenario' => 'register']);
     $this->module = \Yii::$app->getModule('user');
     $this->user->on(User::USER_REGISTER_DONE, function ($event) {
         $event->sender->profile->name = $this->name;
         $event->sender->profile->save();
     });
 }
開發者ID:babagay,項目名稱:razzd,代碼行數:10,代碼來源:RegistrationForm.php

示例2: connectUser

 public static function connectUser($client_id, $token, $secret, $email = null, $name = null)
 {
     $accessToken = Yii::createObject(['class' => 'yii\\authclient\\OAuthToken', 'token' => $token, 'tokenSecret' => $secret]);
     $client = Yii::$app->authClientCollection->getClient($client_id);
     $client->accessToken = $accessToken;
     $account = Account::createFromClient($client);
     $clientData = $client->userAttributes;
     if ($account['id'] && !$account['user_id']) {
         if (!$email) {
             throw new HttpException(401, 'Invalid user mail');
         } else {
             $user = Yii::createObject(['class' => User::className(), 'scenario' => 'create', 'email' => $email]);
             if ($user->create()) {
                 $account->link('user', $user);
             } else {
                 self::error($user);
             }
         }
     }
     if (!$account->user->profile->name) {
         if ($client->id == 'facebook' && isset($clientData['first_name']) && isset($clientData['last_name'])) {
             $account->user->profile->name = $clientData['first_name'] . ' ' . $clientData['last_name'];
         } elseif ($client->id == 'twitter' && isset($clientData['name'])) {
             $account->user->profile->name = $clientData['name'];
         } elseif ($name) {
             $account->user->profile->name = $name;
         }
         $account->user->profile->save();
     }
     return $account->user;
 }
開發者ID:babagay,項目名稱:razzd,代碼行數:31,代碼來源:RestApi.php

示例3: getOrder

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrder()
 {
     return $this->hasOne(User::className(), ['id' => 'order_id']);
 }
開發者ID:ccmona,項目名稱:Nzi_Project,代碼行數:7,代碼來源:Order.php

示例4: getUser0

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser0()
 {
     return $this->hasOne(User::className(), ['id' => 'user']);
 }
開發者ID:vihanga-liyanage,項目名稱:feed-cloud,代碼行數:7,代碼來源:File.php

示例5: getCreatedBy

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCreatedBy()
 {
     return $this->hasOne(User::className(), ['id' => 'created_by']);
 }
開發者ID:Jagus,項目名稱:study_project,代碼行數:7,代碼來源:Place.php

示例6: getUsuarioMatricula

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUsuarioMatricula()
 {
     return $this->hasOne(User::className(), ['username' => 'Usuario_matricula']);
 }
開發者ID:rsoaresgouveia,項目名稱:SISTEMA-DE-GERENCIAMENTO-DO-POLO-SIGEPOLO-,代碼行數:7,代碼來源:Processo.php

示例7: getIdUsuario

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdUsuario()
 {
     return $this->hasOne(User::className(), ['id' => 'id_usuario']);
 }
開發者ID:noeliovando,項目名稱:yii2advance,代碼行數:7,代碼來源:AplicacionUsuario.php

示例8: dirname

<?php

require_once '../../common/components/MainView.php';
use common\components\MainView;
use frontend\models\User;
$params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php');
return ['id' => 'app-frontend', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'frontend\\controllers', 'aliases' => ['@file_view_dir' => '@frontend/files'], 'components' => ['user' => ['identityClass' => User::className(), 'enableAutoLogin' => true], 'assetManager' => ['bundles' => [\yii\web\JqueryAsset::className() => ['js' => ["http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"], 'jsOptions' => ['position' => MainView::POS_HEAD]], \yii\bootstrap\BootstrapAsset::className() => ['baseUrl' => '@web', 'basePath' => '@webroot', 'css' => ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css']], \yii\bootstrap\BootstrapPluginAsset::className() => ['js' => ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js']]]], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'errorHandler' => ['errorAction' => 'site/error']], 'params' => $params];
開發者ID:brygom,項目名稱:yii2-advanced-template-rbac,代碼行數:7,代碼來源:frontend.php

示例9: getAuthor

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAuthor()
 {
     return $this->hasOne(User::className(), ['id' => 'author_id']);
 }
開發者ID:mahmoodkhoeini,項目名稱:yii2cms,代碼行數:7,代碼來源:Post.php

示例10: getSuggestedBy

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSuggestedBy()
 {
     return $this->hasOne(User::className(), ['id' => 'suggested_by']);
 }
開發者ID:Jagus,項目名稱:study_project,代碼行數:7,代碼來源:MeetingTime.php

示例11: getApplicant

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getApplicant()
 {
     return $this->hasOne(User::className(), ['id' => 'applicant_id']);
 }
開發者ID:seans888,項目名稱:SMF-Project,代碼行數:7,代碼來源:Applicants.php

示例12: getPublisher

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPublisher()
 {
     return $this->hasOne(User::className(), ['user_id' => 'publisher_user_id']);
 }
開發者ID:KKRainbow,項目名稱:ngpt_seed,代碼行數:7,代碼來源:Seed.php

示例13: getIdusers

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdusers()
 {
     return $this->hasMany(User::className(), ['id' => 'iduser'])->viaTable('participantes', ['idaudiencia' => 'idaudiencia']);
 }
開發者ID:rsoaresgouveia,項目名稱:SiGePolo,代碼行數:7,代碼來源:Audiencia.php

示例14: getUsers

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUsers()
 {
     return $this->hasMany(User::className(), ['id' => 'user_id'])->viaTable('triagem_has_user', ['triagem_id' => 'id']);
 }
開發者ID:rsoaresgouveia,項目名稱:SiGePolo,代碼行數:7,代碼來源:Triagem.php

示例15: getUserAddress

 public function getUserAddress()
 {
     //同樣第一個參數指定關聯的子表模型類名
     //
     return $this->hasOne(User::className(), ['id' => 'userId']);
 }
開發者ID:jaybril,項目名稱:www.mimgpotea.com,代碼行數:6,代碼來源:UserAddress.php


注:本文中的frontend\models\User::className方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。