How do I get the model of relationships? (and then the models of those relation开发者_如何学运维ships)
Maybe something like below, but im stuck:
$model = Store::model()->findByPk($_GET['id']);
$relation = $model->getMetaData();
$relation = $relation->relations;
foreach($relation as $name=>$relation){
$model_of_relation = ??;
}
Try something like this:
$model = Store::model()->findByPk($_GET['id']);
foreach($model->relations as $relatedModel) {
$model_of_relation = $model->getRelated($relatedModel);
// ... Other processing of $model_of_relation ...
}
精彩评论