public function getBookCategory()
{
return $this->hasMany(BookCategory::className(), ['book_id' => 'id']);
}
public function getCategories(){
return $this -> hasMany(Category::className(), ['id' => 'category_id']) -> via('bookCategory');
}
public function getBookCategory()
{
return $this->hasMany(BookCategory::className(), ['category_id' => 'id']);
}
public function getCategory()
{
return $this->hasOne(Category::className(), ['id' => 'category_id']);
}
public function getBook()
{
return $this->hasOne(Book::className(), ['id' => 'book_id']);
}
error_reporting(E_ALL);
и
Вот, что у меня в консоли выводит: