CGridView + Active Record

Actually I am doing a small inventory system so I have :

  • Products

  • Stores

  • Transactions

  • Inventory

Inventory is a table that has all the info of the products in which store and is automatically updating with the transactions.

Inventory uses the id of the products and the id of the stores.

My actuall problem is that I can not make the CGridView to show the info of the product or the stor instead of the id.

The Models already have every relations, and everything is working. i just want a view that is more friendly.

I know that I can use a SQLSataProvider, but the query is really complicated, and I will not be using the power of the AR.

If anyone can help me I will be very gratefull !

Have a look at the second example


You are right time, was as simple as that … I feel dump now :P.

Any idea on how to implement the sort ? and the advance search ?

Ok, the implementation of the search is really easy when you already have the other relations working. Thanks a lot for everything !