Cdbcriteria Problem - Doesn't Know The Condition Method

Hi,

I implemented this code:




$criteria = new CDbCriteria();

		$criteria->condition('turn='.$turn->attributes['current_turn']);

		$criteria->order('value');


		$dataProvider=new CActiveDataProvider('Result', array( 'criteria'=>$criteria,));



But the Yii always give me error messages:




CException


CDbCriteria and its behaviors do not have a method or closure named "condition".


/var/www/event-teamrace/application/library/base/CComponent.php(266)



But I don’t know why I get this error message, I searched on stackoverflow, the documentation, and my code looks good…

I don’t have idea what is the problem.

Like the error message tells you: order and condition are not methods.

They are properties. So:


$criteria->condition = 'turn='.$turn->attributes['current_turn'];

$criteria->order = 'value';

you can try…


$criteria->addCondition("turn='".$turn->attributes['current_turn']."'");

$criteria->order = 'value';