How To Best Create A Simple Master Detail Screen

I would like to use four models in a master detail screen.

Master Model : Client

Detail Model : Address (MANY)

Detail Model : Account (MANY)

Detail Model : Contacts (MANY)

Detail Model : Sites (MANY)

If I use the Gii generated forms, I can use a CJuiTab widget to display the detail models

$model is the Client model.

$this-> is the Client Controller

The problem I am having is ->find() works to grab the client Address but not the correct address. I need to pass

it ‘client_id’=>$model->id so it returns the client Address.

$this->widget('zii.widgets.jui.CJuiTabs', array(


        'Client'=>$this->renderPartial('_form', array(

			'model'=>$model), true),

        'Address'=>$this->renderPartial('_clientAddress/_form', array(

			'model'=>ClientAddress::model()->find()), true), 










I would really like to pass it an array of Client Addresses but I can’t do that with the _form.

I would need to use CGridView then open each address for editing

It seems very complex for something that should be simple.

Am I not being Yii enough and thinking too relationally? I haven’t broken the Oracle Forms habits.

Thanks for any advice!

Why not just do ajax tabs and pass the ID of the ‘master’ model to the ajax child tab?

Check this link for some ideas on master-detail. Start with something simple (one master one child) and go from there.