Single CGridView for two models/tables


I have two tables book & publisher.

Using the following article, i was able to create form for inserting records.

But i would like to display the details of the book along with publisher in a CGridView.

I searched in documentation & forums, but could not get any idea.

Please help me.

Thanks In Advance

With Regards


You have to define relations and use with if you use ActiveRecords or join the tables manually if you use CSqlDataProvider.

See the post from zaccaria and/or the solved post in this thread.

Also this blog post or this post could be helpful for you.