Advertiser model:
User model:
This is a many to many relationship that is tied in by the user_advertiser table. In my CGridView I want to list the advertiser name, user first name and user last name with role of "sales rep" (fist name and last name are separate fields). I want to be able to sort and also filter by the sale rep first and last name. Anyone have an example of a many to many relationship like mine implemented. I looked at this article but it didn't work for me.
/**
* @return array relational rules.
*/
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(
'users' => array(self::MANY_MANY, 'User', 'user_advertiser(uid,aid)'),
'campaigns' => array(self::HAS_MANY, 'Campaign', 'aid'),
);
}User model:
/**
* @return array relational rules.
*/
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(
'assignments' => array(self::HAS_MANY, 'Assignments', 'userid'),
'advertisers' => array(self::MANY_MANY, 'Advertiser', 'user_advertiser(uid,aid)'),
);
}
This is a many to many relationship that is tied in by the user_advertiser table. In my CGridView I want to list the advertiser name, user first name and user last name with role of "sales rep" (fist name and last name are separate fields). I want to be able to sort and also filter by the sale rep first and last name. Anyone have an example of a many to many relationship like mine implemented. I looked at this article but it didn't work for me.