multiple models in one page,How to & good practice?


i have two models, department and employee,in my index page i want to display two grids as Master/Details , ie when a user selects a department the employees grid populates with employees from that department.

to achieve that i did the following :

i created a new model called (indexModel) extends CFormModel and it has two members


and in the controller i made the proper logic to populate the models and everything works fine.

i want to ask :

if this is a good practice(since i extended CFormModel ;btw CActiveRecord didn’t work in this case ) ?

and is there a better way to do it?

thanks alot.

Well, the main thing is - if this works for you and it gets the job done, then that’s all that really matters.