CDb标准条件

How to make the following SQL condition in CDbcriteria

$dbCommand = Yii::app()->db->createCommand("SELECT * FROM offer_events WHERE enddate >= '$now' AND title like '%$locationdet%' AND description like '%$locationdet%' ORDER BY id DESC ");

You could try doing:

$criteria = new CDbCriteria();
$criteria->condition = 'enddate >=:enddate AND title LIKE :title AND description LIKE :description';
$criteria->params = array(
    ':enddate'=>$enddate, 
    ':title'=> '%' . $title . '%', 
    ':description' => '%' . $description .'%'
);
$criteria->order = 'id DESC';
$model = SomeModel::model()->find($criteria);