Can I set relation that can’t join with id
class User extends CActiveRecord
{
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'client' => array(self::BELONGS_TO,'Client','profile')
);
}
public function search()
{
$criteria=new CDbCriteria(array(
'with'=>'client',
));
$criteria->compare('id',$this->id);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination' => array('pageSize' => 10),
));
}
output: Client.id = User.profile
but I want: Client.name = User.profile