Hi I’m new to yii and I really need help
I’ve been doing a couple of succesful things the last past days with Yii relations, but I can’t find how to achieve this :
I have 3 related models, let’s say
-
Continent
-
Country
-
City
I want to fetch all the cities of a given continent and display it in its view, I have no problem getting all the countries I use this code in the actionView method.
...
$country=new CDbCriteria();
$country->with = array('continent'=>array('select'=>'*'),);
$country->condition="fk_idcontinent=:id";
$country->params=array(":id"=> $id);
$this->render('view', array('countries'=> Country::model()->findAll($country)));
What I want is to find all the cities of the countries of that continent, what should I do next please…