Using ActiveQuery filter with related table

Hello:

Can someone please show me how to use the ActiveQuery ‘filterWhere’ with a table that is related to the table being searched? I’m using code that looks like this:




  $query = Contact::find()					

		->with('company')

		->filterWhere(['like', 'lastname', $search_criteria])

		->orFilterWhere(['like','firstname', $search_criteria])			

	         ->orFilterWhere(['like','email', $search_criteria])				

		->orFilterWhere(['like','title', $search_criteria])			

		->orFilterWhere(['like','company.name', $search_criteria])	//This is the line that fails

		->andWhere(['contact.user_id' => Yii::$app->user->id])				

		->orderBy('lastname asc');	




And whenever I do a search I get the following error:

Column not found: 1054 Unknown column ‘company.name’ in ‘where clause’

How can I filter using the ‘company’ table. And yes I do have my Contact class set up with the proper relation between it and the Company table like so:




	public function getCompany()

	{

        return $this->hasOne(Company::className(), ['id' => 'company_id']);		

	}