You need model classes for both tables, for example
class Profile extends CActiveRecord { ... } class Nationality extends CActiveRecord { ... }
Then in the Profile model, you need to relate to Nationality :
public function relations() { return array( 'nationality' => array(self::BELONGS_TO, 'Nationality', 'nationality'), ), }
The name of the relationship 'nationality' is how you relate to the related model, for example:
$profile = Profile::model()->findByPk($id); echo $profile->nationality->short;
Resources
user213154
source share