コード例 #1
0
ファイル: Meta.php プロジェクト: Penton/MoBlog
 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']);
 }
コード例 #2
0
ファイル: Category.php プロジェクト: andreyMalamuzh/gh-blog
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['category_id' => 'id']);
 }
コード例 #3
0
ファイル: PostComment.php プロジェクト: tampaphp/app-cms
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCommentPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'comment_post_id']);
 }
コード例 #4
0
ファイル: Term.php プロジェクト: ochiem/app-cms
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('{{%term_relationship}}', ['term_id' => 'id']);
 }
コード例 #5
0
ファイル: User.php プロジェクト: ochiem/app-cms
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['post_author' => 'id']);
 }
コード例 #6
0
ファイル: Media.php プロジェクト: wozhen/yii2-cms-writedown
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMediaPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'media_post_id']);
 }
コード例 #7
0
ファイル: Comments.php プロジェクト: andreyMalamuzh/gh-blog
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'id_post']);
 }
コード例 #8
0
ファイル: Comment.php プロジェクト: immortalvlad/yii2-rest
 /**
  * @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']];
 }
コード例 #9
0
ファイル: Cate.php プロジェクト: whystic/yii2-whystic-blog
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['cate_id' => 'id', 'status' => [Post::STATUS_ACTIVE]])->orderBy(['created_at' => SORT_DESC]);
 }
コード例 #10
0
ファイル: PostComment.php プロジェクト: nsdown/getyii
 public function getTopic()
 {
     return $this->hasOne(Post::className(), ['id' => 'post_id'])->where(['type' => 'topic']);
 }
コード例 #11
0
ファイル: User.php プロジェクト: Penton/MoBlog
 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;
 }
コード例 #12
0
ファイル: Attachment.php プロジェクト: Penton/MoBlog
 public function getPost()
 {
     return $this->hasOne(Post::className(), ['cid' => 'parent']);
 }
コード例 #13
0
ファイル: Category.php プロジェクト: viktornord/gh-php-blog
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('category_post', ['category_id' => 'id']);
 }
コード例 #14
0
ファイル: PostType.php プロジェクト: writesdown/app-cms
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['type' => 'id']);
 }
コード例 #15
0
ファイル: Tag.php プロジェクト: VitaliyProdan/hr
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('posts_tags', ['tag_id' => 'id']);
 }