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