class Book extends ActiveRecord
{
....
public static function tableName()
{
return 'books';
}
public function getAuthor()
{
return $this->hasOne(Author::className(), ['id' => 'author_id']);
}
And Author
class Author extends ActiveRecord
{
public static function tableName()
{
return 'authors';
}
public function getBooks()
{
return $this->hasMany(Book::className(), ['author_id' => 'id']);
}
i just want to get author name with books how to do that in girdview in Yii2. I want multiple comma separated books names in a single column just like following
Author Books
Alex C++ Programming,Yii Book,Java Cookbook
What should i do? please help(In Yii 2.0 GridView)