I have used http://www.yiiframework.com/wiki/621/filter-sort-by-calculated-related-fields-in-gridview-yii-2-0/ tutorial and its great for any.
all working fine but I get stuck after adding "Scenario 3 Steps"
// filter by parent name
$query->joinWith(['parent' => function ($q) {
$q->where('parent.first_name LIKE "%' . $this->parentName . '%" ' .
'OR parent.last_name LIKE "%' . $this->parentName . '%"');
}]);
it fires mysql query like:
SELECT COUNT(*) FROM person LEFT JOIN country ON person.country_id = country.id LEFT JOIN person parent ON person.id = parent.parent_id WHERE parent.first_name LIKE "%%" OR parent.last_name LIKE "%%"
which doesnt returns any records.
so how to fix it?