Rendering a CGridView search of a model inside a view of another model

Say I have model Person, with a HAS_MANY relation on the Calls model.

Inside Person’s view view I’d like to show a CGridView with it’s own Calls. Which is basically Calls’ admin view, “locked” on a single Person.

Right now I added Calls model into Person’s controller actionView(), then in Person’s view I added the Calls CGridView with search functions.

And this works fine, but I’d like to understand if I can ease up things by using the relation and without creating the Call model inside the view action.


Hi Maxxer,

Can you please tell me how you did it? I am new at Yii and have been trying to do the same thing but without success. I did not quite understand how you did it?