Defining Jointype On Many_Many Relation

Hi, I’m not sure if this is a bug or not so I’m posting it here first.

I have defined the following relation in my User model




'ActiveNotifications' => array(self::MANY_MANY, 

	'Notification', 'UserNotifications(user_id, notification_id)',

	'condition'=>'notification_id is null',

	'joinType' => 'LEFT JOIN',

),



With this relation I am attempting to find all notifications that have not been viewed by a user. I am using the join table "UserNotifications" to define that the user HAS seen a particular notification. So therefore want this relation to grab all notifications NOT IN the join table for a particular user.

Looking at CActiveFinder.php line 605 it has this


$join='INNER JOIN '.$joinTable->rawName.' '.$joinAlias.' ON ';

Changing this line to


$join=$this->relation->joinType.' '.$joinTable->rawName.' '.$joinAlias.' ON ';

fixes the problem. There is also a hard coded “INNER JOIN” at line 1610, but this wasn’t causing a problem in my case.

There are other ways I could solve my unseen notification problem, but I just thought that this might still be considered a bug.

This is on Yii version 1.1.14

Cheers,