public function searchWithRelated() {
$criteria = new CDbCriteria;
$criteria->together = true; //without this you wont be able to search the second table's data
$criteria->with = array('mySecondTable');
$criteria->compare('id', $this->id, true);
$criteria->compare('mySecondTable.column', $this->mySecondTable_column, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
'sort'=>array(
'defaultOrder'=>'t.create_time DESC',
),
'pagination' => array(
'pageSize' => 100,
),
));
}