hello,
i have the following situation:
table xyz i has a relation:
'user' => array(self::BELONGS_TO, 'User', 'userId'),
the user relation above has a relation:
'team' => array(self::BELONGS_TO, 'TeamType', 'teamId'),
in gridview for xyz i’m able to show the attributes of the ‘team’ table by writing: ‘user.team.name’.
but, when i want to search by the field, i get an error ‘column not found’.
I’ve added the following:
-
attribute ‘team_name’ to the xyz model.
-
in the search function of xyz model:
a. $criteria->with = array(‘user’,‘user.team’);
b. $criteria->together = true;
c. $criteria->compare(‘user.team_name’, $this->team_name, true);
d. in the sort object of the dataprovider:
'user_team'=>array(
'asc'=>'user.team.name',
'desc'=>'user.team.name DESC',
),
what am i doing wrong?
thanks.