我在我的BlogSearch中查詢,我加入與用戶的關係。在我的專欄用戶中,我想通過他的全名搜索用戶。這是我的BlogSearch代碼。在一個列搜索全名搜索
$query->joinWith('relUser');
$query->andFilterWhere([
'Id' => $this->Id,
'CreatedAt' => $this->CreatedAt,
]);
$query->andFilterWhere(['like', 'Title', $this->Title])
->andFilterWhere(['like', 'Description', $this->Description])
->andFilterWhere(['like', 'User.Name', $this->Rel_User])
->andFilterWhere(['like', 'User.Surname', $this->Rel_User]);
什麼意思不工作,,錯誤,,錯誤的結果?..請顯示所有的搜索模型 – scaisEdge
我怎樣才能將我的列連接成一個? – qwerty
你想在哪裏連接列,,, sqlquery? ,,, gridview列)?更正你的問題,並有適當的解釋,並顯示你的相關searchModel,controllerAction和查看請.. – scaisEdge