$criteria = new CDbCriteria; // Classic method $criteria->addCondition('t.id = :id'); $criteria->params = array(':id' => Yii::app()->user->id); // Often used in search functions. Note: if passed value is empty, the WHERE is not added! $criteria->compare('t.id', Yii::app()->user->id); // This is my current favorite $criteria->addColumnCondition(array('t.id' => Yii::app()->user->id)); // A bit weird here, but you can also do this $criteria->addInCondition('t.id', array(Yii::app()->user->id));
No comments:
Post a Comment