我需要将param传递给join
中的on $criteria = new CDbCriteria;
$criteria->join = "left join invoices v1 on t.id=v1.s_id and v1.year=:year";
$criteria->params= array(':year'=>$category->year); //will not work
错误参数号无效:绑定变量数与数量不匹配 令牌
或者是否可以在我的模型中实现
public function relations()
{
return array(
'invoices'=>array(self::BELONGS_TO, 'invoices', '', 'on'=>'t.id=invoices.sid and v1.year=:year', 'joinType'=>'left JOIN', 'alias'=>'invoices' ), //how to pass param :year?
如何在连接中传递参数? 谢谢