当前位置: 首页>>代码示例>>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;未经允许,请勿转载。