I have 3 Tables:
CREATE TABLE tabCve
(
intCveID INTEGER NOT NULL AUTO_INCREMENT,
strNumber VARCHAR(20) NOT NULL,
fltScore FLOAT(0),
strDescriptio
In your seachModel you need public var for filter ..
not need select because this are provide by find.. and is better rearrange the code below
$query->select(["intCveID","strNumber","fltScore","strDescription","datImported","intCvePhaseID","intCveTypeID",'progress.intProgressCategoryID']);
$query->joinWith("phase");
$query->joinWith("type");
$query->joinWith("progress");
$query->Where(['not like', 'strDescription', '** RESERVED **%', false]);
$query->andWhere(['not like', 'strDescription', '** REJECT **%', false]);
in another way like suggested in this doc
http://www.yiiframework.com/wiki/621/filter-sort-by-calculated-related-fields-in-gridview-yii-2-0/
http://www.yiiframework.com/wiki/653/displaying-sorting-and-filtering-model-relations-on-a-gridview/
For
->andFilterWhere(['like','tabProgress.tabCategory.strCategory', $this->intCveTypeID])
the samples provide in the link above suggest the use of getter for retrieve the column you need and the use of this getter also in andFilterWhere
this way :
in your Model you already have a
public function getCategory()
{
return $this->hasOne(TabCategory::className(),
['intCategoryID' => 'intProgressCategoryID']);
}
then you can buil a getter for for strCategory
public function getStr_category() {
return $this->category->strCategory;
}
at this point you can retrieve the data in you modelSearch with
->andFilterWhere(['like','str_category', $this->intCveTypeID])