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']); }
/** * @return \yii\db\ActiveQuery */ public function getPosts() { return $this->hasMany(Post::className(), ['category_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getCommentPost() { return $this->hasOne(Post::className(), ['id' => 'comment_post_id']); }
/** * @return \yii\db\ActiveQuery */ public function getPosts() { return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('{{%term_relationship}}', ['term_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getPosts() { return $this->hasMany(Post::className(), ['post_author' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getMediaPost() { return $this->hasOne(Post::className(), ['id' => 'media_post_id']); }
/** * @return \yii\db\ActiveQuery */ public function getIdPost() { return $this->hasOne(Post::className(), ['id' => 'id_post']); }
/** * @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']]; }
public function getPosts() { return $this->hasMany(Post::className(), ['cate_id' => 'id', 'status' => [Post::STATUS_ACTIVE]])->orderBy(['created_at' => SORT_DESC]); }
public function getTopic() { return $this->hasOne(Post::className(), ['id' => 'post_id'])->where(['type' => 'topic']); }
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; }
public function getPost() { return $this->hasOne(Post::className(), ['cid' => 'parent']); }
public function getPosts() { return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('category_post', ['category_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getPosts() { return $this->hasMany(Post::className(), ['type' => 'id']); }
public function getPosts() { return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('posts_tags', ['tag_id' => 'id']); }