本文整理汇总了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();
});
}
示例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;
}
示例3: getOrder
/**
* @return \yii\db\ActiveQuery
*/
public function getOrder()
{
return $this->hasOne(User::className(), ['id' => 'order_id']);
}
示例4: getUser0
/**
* @return \yii\db\ActiveQuery
*/
public function getUser0()
{
return $this->hasOne(User::className(), ['id' => 'user']);
}
示例5: getCreatedBy
/**
* @return \yii\db\ActiveQuery
*/
public function getCreatedBy()
{
return $this->hasOne(User::className(), ['id' => 'created_by']);
}
示例6: getUsuarioMatricula
/**
* @return \yii\db\ActiveQuery
*/
public function getUsuarioMatricula()
{
return $this->hasOne(User::className(), ['username' => 'Usuario_matricula']);
}
示例7: getIdUsuario
/**
* @return \yii\db\ActiveQuery
*/
public function getIdUsuario()
{
return $this->hasOne(User::className(), ['id' => 'id_usuario']);
}
示例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];
示例9: getAuthor
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthor()
{
return $this->hasOne(User::className(), ['id' => 'author_id']);
}
示例10: getSuggestedBy
/**
* @return \yii\db\ActiveQuery
*/
public function getSuggestedBy()
{
return $this->hasOne(User::className(), ['id' => 'suggested_by']);
}
示例11: getApplicant
/**
* @return \yii\db\ActiveQuery
*/
public function getApplicant()
{
return $this->hasOne(User::className(), ['id' => 'applicant_id']);
}
示例12: getPublisher
/**
* @return \yii\db\ActiveQuery
*/
public function getPublisher()
{
return $this->hasOne(User::className(), ['user_id' => 'publisher_user_id']);
}
示例13: getIdusers
/**
* @return \yii\db\ActiveQuery
*/
public function getIdusers()
{
return $this->hasMany(User::className(), ['id' => 'iduser'])->viaTable('participantes', ['idaudiencia' => 'idaudiencia']);
}
示例14: getUsers
/**
* @return \yii\db\ActiveQuery
*/
public function getUsers()
{
return $this->hasMany(User::className(), ['id' => 'user_id'])->viaTable('triagem_has_user', ['triagem_id' => 'id']);
}
示例15: getUserAddress
public function getUserAddress()
{
//同样第一个参数指定关联的子表模型类名
//
return $this->hasOne(User::className(), ['id' => 'userId']);
}