/** * @return \yii\db\ActiveQuery */ public function getPosts() { return $this->hasMany(YBoardPost::className(), ['user_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getLastPost() { return $this->hasOne(YBoardPost::className(), ['id' => 'last_post_id']); }
/** * @return array relational rules. */ public function getLastPost() { // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return $this->hasOne(YBoardPost::className(), ['id' => 'last_post_id']); }