The Criteria Class Function Addnotincondition Gives Me An Error

Hello,

I have a code like this one:




$criteria=new CDbCriteria;

$criteria->condition='Column1=:Column1';


$criteria->addNotInCondition('fk_relationTable.column2', array('ONE','TWO','THREE'));

$criteria->with->findAll();



And the error is in AddNotIncondition, the sql of that condition is like this:

fk_relationTable.column2 not in(:ycp0,:ycp1,:ycp2) and it should be that:

fk_relationTable.column2 not in(‘ONE’,‘TWO’,:‘THREE’)

What is the problem ?

Thanks in advance !

That’s ok, these things are just placeholders for binding. Yii will bind them for you.

Your error is probably caused by unbound param :Column1.

Don’t forget to bind it somewhere, for example like this:

$criteria->params[’:Column1’] = ‘your value here’;

You can also use some other ways of adding conditions, see docs