I have following 3 models
Group
User
Section
the relation in Group Model
'members' => array(self::MANY_MANY, 'User', 'int_user_group(group_id,user_id)'),
Relation in User model
'section' => array(self::BELONGS_TO, 'Section', 'section_id'),
I tried this
$criteria = new CDbCriteria();
$criteria->with = array('members' => array('select' => 'members.designation,members.id', 'with' => array('section' => array('select' => 'section.name'))));
$criteria->select = 'id,name';
$criteria->condition = 't.id=:groupID';
$criteria->params = array(':groupID' => $this->id);
$selected_members = self::model()->findAll($criteria);
Now $selected_members will be an array of objects? what is the procedure to traverse this array and access each selected field of 3 tables selected in above code, i want to do some manipulation with the selected results manually using foreach.