cdbcriteria how to pass param to the on clause in join


I need to pass param to the on in join

	$criteria	= new CDbCriteria;

                $criteria->join	= "left join invoices v1 on and v1.year=:year";

               $criteria->params= array(':year'=>$category->year); //will not work

 error Invalid parameter number: number of bound variables does not match number of


or if it could be implemented in my model

public function relations()


	return array(

		  'invoices'=>array(self::BELONGS_TO, 'invoices', '', 'on'=>' and v1.year=:year', 'joinType'=>'left JOIN', 'alias'=>'invoices' ), //how to pass param :year?

how to pass the param in the join in either case ?

Thank you

using the condition keyword? something like:

invoices'=>array(self::BELONGS_TO, 'invoices', '', 'on'=>' and v1.year=:year', 'joinType'=>'left JOIN', 'alias'=>'invoices', 'condition'=>('year = blabla') ),