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


PHP Post::className方法代码示例

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


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

示例1: getPosts

 public function getPosts($isPublished = true)
 {
     $query = $this->hasMany(Post::className(), ['cid' => 'cid'])->with('categories')->with('tags')->with('author')->orderByCid();
     if ($isPublished) {
         $query = $query->published();
     }
     return $query->viaTable(Relationship::tableName(), ['mid' => 'mid']);
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:8,代码来源:Meta.php

示例2: getPosts

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['category_id' => 'id']);
 }
开发者ID:andreyMalamuzh,项目名称:gh-blog,代码行数:7,代码来源:Category.php

示例3: getCommentPost

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCommentPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'comment_post_id']);
 }
开发者ID:tampaphp,项目名称:app-cms,代码行数:7,代码来源:PostComment.php

示例4: getPosts

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('{{%term_relationship}}', ['term_id' => 'id']);
 }
开发者ID:ochiem,项目名称:app-cms,代码行数:7,代码来源:Term.php

示例5: getMediaPost

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMediaPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'media_post_id']);
 }
开发者ID:wozhen,项目名称:yii2-cms-writedown,代码行数:7,代码来源:Media.php

示例6: getIdPost

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'id_post']);
 }
开发者ID:andreyMalamuzh,项目名称:gh-blog,代码行数:7,代码来源:Comments.php

示例7: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['content'], 'filter', 'filter' => function ($value) {
         return \Yii::$app->formatter->asHtml($value);
     }], [['content', 'post_id'], 'required'], [['content'], 'string', 'max' => 128], [['post_id'], 'exist', 'targetClass' => Post::className(), 'targetAttribute' => 'id']];
 }
开发者ID:immortalvlad,项目名称:yii2-rest,代码行数:9,代码来源:Comment.php

示例8: getPosts

 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['cate_id' => 'id', 'status' => [Post::STATUS_ACTIVE]])->orderBy(['created_at' => SORT_DESC]);
 }
开发者ID:whystic,项目名称:yii2-whystic-blog,代码行数:4,代码来源:Cate.php

示例9: getTopic

 public function getTopic()
 {
     return $this->hasOne(Post::className(), ['id' => 'post_id'])->where(['type' => 'topic']);
 }
开发者ID:nsdown,项目名称:getyii,代码行数:4,代码来源:PostComment.php

示例10: getPosts

 public function getPosts($isPublished = true)
 {
     $query = $this->hasMany(Post::className(), ['authorId' => 'uid'])->with('categories')->with('tags')->with('author')->orderByCid();
     if ($isPublished) {
         return $query->published();
     }
     return $query;
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:8,代码来源:User.php

示例11: getPost

 public function getPost()
 {
     return $this->hasOne(Post::className(), ['cid' => 'parent']);
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:4,代码来源:Attachment.php

示例12: getPosts

 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('category_post', ['category_id' => 'id']);
 }
开发者ID:viktornord,项目名称:gh-php-blog,代码行数:4,代码来源:Category.php


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