model relations

how to create relation for 4 models(tables)…and allthier fields to be rendered into a view…??

The easiesy way to create relations is to use storage engine InnoDb, add the foreign key and use gii for generate the models, it will generate all relations with one click.

For display in a view, once you have the model in a variable, you can call:

$model->name // displays a field of the main model

$model->relatedModel1->name // displays a field of the relatedModel1

And so on. Is much easier to do it than to explain.

thanq…but intead of dat i have created instances of models n rendred dem into view…