我想知道的是,如何将连接查询添加到 yii 搜索功能中。
搜索功能在货币模型中。(currency.php)
>public function search()
{
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id,true);
$criteria->compare('name',$this->name,true);
$criteria->compare('sign',$this->sign,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
我想将连接查询添加到该函数。我的查询是这样的:
SELECT * FROM currency cur INNER JOIN currency_option curopt ON cur.id = curopt.currency_id AND curopt.company_id = '$com_id'。
任何人请帮助我。非常感谢!