当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::tableName方法代码示例

本文整理汇总了PHP中app\models\Tag::tableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::tableName方法的具体用法?PHP Tag::tableName怎么用?PHP Tag::tableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Tag的用法示例。


在下文中一共展示了Tag::tableName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTopics

 public static function getTopics($tagId, $pages)
 {
     $key = 'topics-tag-' . $tagId . '-p-' . $pages->getPage();
     $cache = Yii::$app->getCache();
     $settings = Yii::$app->params['settings'];
     if (intval($settings['cache_enabled']) === 0 || ($models = $cache->get($key)) === false) {
         $models = static::find()->select(['id', 'topic_id'])->where(['tag_id' => $tagId])->orderBy(['id' => SORT_DESC])->offset($pages->offset)->with(['topic.node', 'topic.author', 'topic.lastReply'])->limit($pages->limit)->asArray()->all();
         if (intval($settings['cache_enabled']) !== 0) {
             $dep = new DbDependency(['sql' => 'SELECT MAX(updated_at) FROM ' . Tag::tableName() . 'where id = ' . $tagId]);
             $cache->set($key, $models, intval($settings['cache_time']) * 60, $dep);
         }
     }
     return $models;
 }
开发者ID:littleboss,项目名称:simpleforum,代码行数:14,代码来源:TagTopic.php

示例2: up

 public function up()
 {
     //初始化设置表
     $tableName = Config::tableName();
     $this->createTable($tableName, ['name' => Schema::TYPE_STRING . "(64) NOT NULL COMMENT '名称'", 'value' => Schema::TYPE_TEXT . " NOT NULL COMMENT '保存的值'", 'PRIMARY KEY (name)'], $this->tableOptions);
     //附件表
     $tableName = Storage::tableName();
     $this->createTable($tableName, ['id' => Schema::TYPE_PK, 'uid' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '用户id'", 'name' => Schema::TYPE_STRING . " NOT NULL DEFAULT '' COMMENT '原始文件名'", 'path' => Schema::TYPE_STRING . " NOT NULL DEFAULT '' COMMENT '保存路径'", 'size' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '文件大小'", 'mime_type' => Schema::TYPE_STRING . "(50) NOT NULL DEFAULT '' COMMENT '文件类型'", 'bin' => Schema::TYPE_STRING . "(30) NOT NULL DEFAULT '' COMMENT '存储容器'", 'type' => Schema::TYPE_STRING . "(50) NOT NULL DEFAULT '' COMMENT '所属类型'", 'status' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0' COMMENT '附件存储状态'", 'created_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间'", 'updated_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间'"], $this->tableOptions);
     $this->createIndex('uid', $tableName, 'uid');
     $this->createIndex('type', $tableName, ['type', 'id']);
     //标签表
     $tableName = Tag::tableName();
     $this->createTable($tableName, ['id' => Schema::TYPE_PK, 'name' => Schema::TYPE_STRING . "(64) NOT NULL COMMENT '标签名'", 'icon' => Schema::TYPE_STRING . " NOT NULL DEFAULT '' COMMENT '标签图标'", 'description' => Schema::TYPE_TEXT . " NOT NULL COMMENT '版块介绍'", 'status' => Schema::TYPE_BOOLEAN . " NOT NULL DEFAULT '0' COMMENT '标签状态'", 'created_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间'", 'updated_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间'"]);
     $this->createIndex('name', $tableName, 'name', true);
     $this->createIndex('status', $tableName, ['status', 'id']);
     //标签数据表
     $tableName = TagItem::tableName();
     $this->createTable($tableName, ['id' => Schema::TYPE_PK, 'tid' => Schema::TYPE_STRING . "(64) NOT NULL COMMENT '标签id'", 'target_id' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '目标id'", 'target_type' => Schema::TYPE_STRING . "(100) NOT NULL DEFAULT '' COMMENT '目标类型'", 'created_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间'"]);
     $this->createIndex('item', $tableName, ['tid', 'target_id', 'target_type'], true);
     $this->createIndex('target_type', $tableName, ['target_type', 'target_id']);
 }
开发者ID:yii2-chinesization,项目名称:yii-qa,代码行数:21,代码来源:m140910_000000_initTable.php

示例3: actions

 public function actions()
 {
     return ['autocomplete' => ['class' => 'app\\components\\AutocompleteAction', 'tableName' => Tag::tableName(), 'field' => 'name']];
 }
开发者ID:GHubgenius,项目名称:dcms,代码行数:4,代码来源:PostController.php


注:本文中的app\models\Tag::tableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。