How to use alias table name with CDbCriteria using Yii Framework

public function getUserOpts($op=null)
{
	$ret=User::model()
		->active()
		->with(array('userTypeVal.userType' => array('alias' => 'ut')));

	if(empty($op))
	{
		return $ret->findAll('ut.name="company-official"');
	}
	else
	{
		return $ret->find('ut.name="company-official" and t.id=:uid',array(':uid'=>$op));
	}
}
Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *