When linking news with categories, the search by id and title stopped in the GridView. Gives an error message:
SQLSTATE [23000]: Integrity constraint violation: 1052 Column 'id' in clause is the ambiguous
category=123_news_category.idWHEREid= '2'
In the model:
public function getNewsCategory() { return News::hasOne(NewsCategory::className(), ['id' => 'category']); } In search:
$query->joinWith('newsCategory'); In the gridview:
'category' => [ 'attribute' => 'category', 'value' => function($model){ return $model->newsCategory['title']; }, 'filter' => NewsCategory::allNewsCategory(), ], But searching by categories, views and status works.