public function getPosts() { return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('{{%podium_vocabulary_junction}}', ['word_id' => 'id']); }
public function getLatest() { return $this->hasOne(Post::className(), ['forum_id' => 'id'])->orderBy(['id' => SORT_DESC]); }
/** * First edited not seen post relation. * @return Post */ public function getFirstEditedNotSeen() { return $this->hasOne(Post::className(), ['thread_id' => 'id'])->where(['>', 'edited_at', $this->userView ? $this->userView->edited_last_seen : 0])->orderBy(['id' => SORT_ASC]); }