Hi,
I have a model with 2 relations to the same model/table:
Class Work extends CActiveRecord
{
public function relations()
{
return array(
'user' => array(self::BELONGS_TO, 'User', 'user_id'),
'other_user' => array(self::BELONGS_TO, 'User', 'other_user_id'),
);
}
Then I have a search method that returns data provider for that model:
public function search()
{
$criteria=new CDbCriteria;
$criteria->with = array('user','other_user','other_user.profile');
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
I use that search method for grid view, but it returns an error:
as you can see, the SQL doesn’t use the table alias from the relation’s name. Why?