public function search()
{
$criteria = new CDbCriteria();
$criteria->compare('t.id', $this->id);
$criteria->compare('create_time', $this->create_time, true);
$criteria->compare('update_time', $this->update_time, true);
if ($this->date) {
$criteria->compare('date', date('Y-m-d', strtotime($this->date)));
}
$criteria->compare('title', $this->title, true);
$criteria->compare('t.slug', $this->slug, true);
$criteria->compare('short_text', $this->short_text, true);
$criteria->compare('full_text', $this->full_text, true);
$criteria->compare('user_id', $this->user_id);
$criteria->compare('t.status', $this->status);
$criteria->compare('category_id', $this->category_id, true);
$criteria->compare('is_protected', $this->is_protected);
$criteria->compare('t.lang', $this->lang);
$criteria->with = ['category'];
return new CActiveDataProvider(get_class($this), ['criteria' => $criteria, 'sort' => ['defaultOrder' => 'date DESC']]);
}