當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。