本文整理匯總了PHP中app\modules\user\models\User::tableName方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::tableName方法的具體用法?PHP User::tableName怎麽用?PHP User::tableName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\modules\user\models\User
的用法示例。
在下文中一共展示了User::tableName方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: up
public function up()
{
$table = Vote::tableName();
$this->createTable($table, ['answer_id' => $this->integer(), 'user_id' => $this->integer(), 'created_at' => $this->integer()]);
MigrationHelper::addForeignKey($table, 'answer_id', Answer::tableName(), 'id', 'CASCADE', 'CASCADE');
MigrationHelper::addForeignKey($table, 'user_id', User::tableName(), 'id', 'SET NULL', 'CASCADE');
}
示例2: up
public function up()
{
$table = \app\modules\poll\models\Comment::tableName();
$this->createTable($table, ['id' => $this->primaryKey(), 'user_id' => $this->integer(), 'question_id' => $this->integer(), 'created_at' => $this->integer(), 'message' => $this->text()]);
MigrationHelper::addForeignKey($table, 'user_id', \app\modules\user\models\User::tableName(), 'id', 'SET NULL', 'CASCADE');
MigrationHelper::addForeignKey($table, 'question_id', \app\modules\poll\models\Question::tableName(), 'id', 'CASCADE', 'CASCADE');
}
示例3: getManagersList
protected function getManagersList()
{
$managers = Yii::$app->cache->get('ManagersList');
if ($managers === false) {
$managers = User::find()->join('INNER JOIN', '{{%auth_assignment}}', '{{%auth_assignment}}.user_id = ' . User::tableName() . '.id')->where(['{{%auth_assignment}}.item_name' => 'manager'])->all();
$managers = ArrayHelper::map($managers, 'id', 'username');
Yii::$app->cache->set('ManagersList', $managers, 86400, new TagDependency(['tags' => [\devgroup\TagDependencyHelper\ActiveRecordHelper::getCommonTag(User::className())]]));
}
return $managers;
}
示例4: hasUser
/**
* We just check whether module is installed and user is logged in.
* @return bool
*/
public static function hasUser()
{
if (!Yii::$app instanceof Application) {
return false;
}
if (!Yii::$app->db->getTableSchema(User::tableName())) {
return false;
}
try {
$identityClass = Yii::$app->user->identityClass;
} catch (\Exception $e) {
$identityClass = false;
}
if (!$identityClass) {
return false;
}
return !Yii::$app->user->isGuest;
}
示例5: search
/**
* Search tasks
* @param $params
* @param bool $withUser
* @return ActiveDataProvider
*/
public function search($params, $withUser = false)
{
$query = self::find();
$query->joinWith(['task', 'task.initiatorUser']);
$dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10], 'sort' => ['defaultOrder' => ['ts' => SORT_DESC]]]);
$dataProvider->sort->attributes['name'] = ['asc' => [Task::tableName() . '.name' => SORT_ASC], 'desc' => [Task::tableName() . '.name' => SORT_DESC]];
$dataProvider->sort->attributes['username'] = ['asc' => [\app\modules\user\models\User::tableName() . '.username' => SORT_ASC], 'desc' => [User::tableName() . '.username' => SORT_DESC]];
if ($withUser) {
$query->andWhere([Task::tableName() . '.initiator' => \Yii::$app->user->id]);
}
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$this->addCondition($query, User::tableName(), 'username', true);
$this->addCondition($query, $this->tableName(), 'ts', true);
$this->addCondition($query, Task::tableName(), 'name', true);
$this->addCondition($query, $this->tableName(), 'result_status');
return $dataProvider;
}
示例6: down
public function down()
{
$this->dropTable('{{%user_category}}');
$this->dropTable('{{%user_eav}}');
$this->dropTable('{{%user_property}}');
$this->dropTable(UserService::tableName());
$this->dropTable(User::tableName());
$this->dropTable('{{%auth_assignment}}');
$this->dropTable('{{%auth_item_child}}');
$this->dropTable('{{%auth_item}}');
$this->dropTable('{{%auth_rule}}');
$this->dropTable(ErrorUrl::tableName());
$this->dropTable(ErrorLog::tableName());
$this->dropTable(Review::tableName());
$this->dropTable(Notification::tableName());
$this->dropTable('{{%submission_eav}}');
$this->dropTable('{{%submission_category}}');
$this->dropTable('{{%submission_property}}');
$this->dropTable(Submission::tableName());
$this->dropTable('{{%form_property}}');
$this->dropTable('{{%form_eav}}');
$this->dropTable(Form::tableName());
$this->dropTable('{{%order_category}}');
$this->dropTable('{{%order_eav}}');
$this->dropTable('{{%order_property}}');
$this->dropTable(PaymentType::tableName());
$this->dropTable(ShippingOption::tableName());
$this->dropTable(OrderChat::tableName());
$this->dropTable(OrderTransaction::tableName());
$this->dropTable(OrderItem::tableName());
$this->dropTable(Order::tableName());
$this->dropTable(SubscribeEmail::tableName());
$this->dropTable(CategoryGroupRouteTemplates::tableName());
$this->dropTable('{{%product_category}}');
$this->dropTable('{{%property_category}}');
$this->dropTable('{{%category_eav}}');
$this->dropTable(Category::tableName());
$this->dropTable(CategoryGroup::tableName());
$this->dropTable('{{%page_eav}}');
$this->dropTable('{{%page_category}}');
$this->dropTable('{{%page_property}}');
$this->dropTable(Page::tableName());
$this->dropTable(ViewObject::tableName());
$this->dropTable(View::tableName());
$this->dropTable(Layout::tableName());
$this->dropTable('{{%product_property}}');
$this->dropTable(Product::tableName());
$this->dropTable(Property::tableName());
$this->dropTable(Route::tableName());
$this->dropTable('{{%product_eav}}');
$this->dropTable('{{%product_static_value_full_slug}}');
$this->dropTable('{{%product_category_full_slug}}');
$this->dropTable(PropertyStaticValues::tableName());
$this->dropTable(PropertyHandler::tableName());
$this->dropTable(PropertyGroup::tableName());
$this->dropTable(ObjectStaticValues::tableName());
$this->dropTable(ObjectPropertyGroup::tableName());
$this->dropTable(Object::tableName());
$this->dropTable(DynamicContent::tableName());
$this->dropTable(Navigation::tableName());
$this->dropTable(Image::tableName());
$this->dropTable('{{%session}}');
$this->dropTable(ApiService::tableName());
}
示例7: up
public function up()
{
$this->createTable(Question::tableName(), ['id' => $this->primaryKey(), 'user_id' => $this->integer(), 'status' => $this->smallInteger(), 'type' => $this->smallInteger(), 'relation_id' => $this->string(), 'event_object' => $this->text(), 'title' => $this->string(), 'description' => $this->text(), 'created_at' => $this->integer()]);
MigrationHelper::addForeignKey(Question::tableName(), 'user_id', User::tableName(), 'id', 'SET NULL', 'CASCADE');
}
示例8: search
/**
* Search tasks
* @param $params
* @return ActiveDataProvider
*/
public function search($params)
{
/* @var $query \yii\db\ActiveQuery */
$query = self::find();
$query->joinWith('initiatorUser');
$dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
$dataProvider->sort->attributes['username'] = ['asc' => [User::tableName() . '.username' => SORT_ASC], 'desc' => [User::tableName() . '.username' => SORT_DESC]];
$query->andWhere($this->tableName() . '.type = :type', [':type' => 'REPEAT']);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$this->addCondition($query, $this->tableName(), 'id');
$this->addCondition($query, $this->tableName(), 'name', true);
$this->addCondition($query, $this->tableName(), 'description', true);
$this->addCondition($query, $this->tableName(), 'action', true);
$this->addCondition($query, $this->tableName(), 'params', true);
$this->addCondition($query, $this->tableName(), 'cron_expression', true);
$this->addCondition($query, $this->tableName(), 'ts', true);
$this->addCondition($query, $this->tableName(), 'status');
$this->addCondition($query, User::tableName(), 'username', true);
return $dataProvider;
}
示例9: down
public function down()
{
$this->dropTable(User::tableName());
}
示例10: down
public function down()
{
$this->dropTable(User::tableName());
$this->dropTable(Avatar::tableName());
$this->dropTable(Meta::tableName());
}
示例11: down
public function down()
{
$this->alterColumn(User::tableName(), 'password_reset_token', 'VARBINARY(32)');
}
示例12: minusBalance
public static function minusBalance($user_id, $sum = 0)
{
//если не указали сумму, значит берём из настроек сумму за одну проверку и списываем её
if ($sum == 0) {
$sum = \Yii::$app->params['task.cost'];
}
if ($user_id) {
$query = \Yii::$app->db->createCommand('UPDATE ' . User::tableName() . ' SET balance=(balance-:sum_minus) WHERE id=:id');
$query->bindValues([':id' => $user_id, ':sum_minus' => $sum]);
$query->execute();
}
}