if U want go get type for each of those, U an just do
foreach($user->userInterest as $userInterest)
{
$interest = $userInterest->interest; // get interest record
}
From UserInterestRelations model
$userInterestRelation->user // get user record
$userInterestRelation->interest // get interest record
From Interest model
$interest->userInterest // all records related to this type
foreach($interest->userInterest as $userInterest)
{
$user = $userInterest->user // get users record
}
As georaldc said, Gii can take care of this for you. If you start building your relations at the database level, then use Gii to whip up the model for you, and the relations will be handled by Yii automatically with minimal work at the code level.