/** * @return \yii\db\ActiveQuery */ public function getAuthor() { return $this->hasOne(Author::className(), ['id' => 'author_id']); }
/** * @return \yii\db\ActiveQuery */ public function getAuthor() { return $this->hasOne(Author::className(), ['id' => 'author_id'])->inverseOf('books'); }
/** * @return \yii\db\ActiveQuery */ public function getBookAuthors() { return $this->hasMany(Author::className(), ['id' => 'authorId'])->viaTable('author_book', ['bookId' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getAuthor() { return $this->hasOne(Author::className(), ['id' => 'author_id'])->from(['author' => Author::tableName()]); }