Cdbcriteria My Own Custom 'on' Join Criteria

Hi,

I try to set a custom ‘on’ in Yii CDbCriteria ‘with’ like this (I want to select rows from Users table but only those that do not have related values in other table for a given user only):




$criteria = new CDbCriteria(array(

    'select' => 'id',

    'together' => true,

    'with' => array('otherTable' => array(

        'select' => false,

        'condition' => 'g.id IS NULL',

        'joinType' => 'LEFT JOIN'

        'on' => 'otherTable.user_id != ' . $user->id,

    ))

);



In Yii help it is specified that:

ON clause. The condition specified here will be appended to the joining condition using AND operator.

How can I have full control over ‘on’ value but still use CDbCriteria (I know that I can write sql myself, just wandering if I can do the same in CActiveDataProvider+CDbCriteria)? I do not want sql to have condition after ON like this: ON (g.user_id=t.id) AND ( otherTable.user_id != 1 )

I just want to have my own ‘ON’ condition string in sql.

In other words I do not want Yii do add following string in sql query: b AND[/b]

So I’m not sure how to achieve it with CDbCriteria…

Any help?

Thanks,

Kris