How To Add Condition For Parent Table Aftrer Added A Rertaionship With Anothe Table

$orgContacts = OrganizationContact::model()->with(‘type’)->findAll();

now i want to take all record that OrganizationContact->org_id = 2 how i do that?

i added relation with

public function relations()

{


	// NOTE: you may need to adjust the relation name and the related


	// class name for the relations automatically generated below.


	return array(


		'type' => array(self::BELONGS_TO, 'ContactType', 'type_id'),


	);


}

$orgContacts = OrganizationContact::model()->with(‘type’)->findAll(‘org_id=:org_id’,array(’:org_id’=>$_GET[‘id’]));

not working as this way

What error you are getting here. Could you please show that error.




try this might be it will work

$orgContacts = OrganizationContact::model()->with('type')->findAll('t.org_id=:org_id',array(':org_id'=>$_GET['id']));