Multi level relationships

How do I get the model of relationships? (and then the models of those relationships)




$model = Store::model()->findByPk($_GET['id']);


$relation = $model->getMetaData();


$relation = $relation->relations;


foreach($relation as $name=>$relation){


  $model_of_relation = ??;


}



The model you search is




$name => $relation



each $name,$relation is your model: try with




foreach($relation as $item){

  echo $item->attributeOfModel;

}