/** * @return ActiveQuery */ public function getPosts() { return $this->hasMany(PostModels::className(), ['topic_id' => 'id'])->inverseOf('user'); }
/** * @return ActiveQuery */ public function getPost() { return $this->hasone(PostModels::className(), ['id' => 'post_id']); }