What I'm doing wrong.
The SQL being executed was: SELECT COUNT(*) FROM ProductInGrowStage
LEFT JOIN CultureGrowStage
ON ProductInGrowStage
.growStageId
= CultureGrowStage
.id
LEFT JOIN Culture
ON CultureGrowStage
.cultureId
= Culture
.id
LEFT JOIN Product
ON ProductInGrowStage
.productId
= Product
.id
LEFT JOIN Vermin
ON ProductInGrowStage
.verminId
= Vermin
.id
WHERE СultureGrowStage
.id
='2'
public function search($params)
{
$query = ProductInGrowStage::find()->joinWith(['growStage.culture','product','vermin']);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'Product.id' => $this->productId,
'Vermin.id' => $this->verminId,
'Culture.id' => $this->cultureId,
'СultureGrowStage.id' => $this->growStageId,
]);
$query->andFilterWhere(['like', 'doze', $this->doze])
->andFilterWhere(['like', 'commentForVermin', $this->commentForVermin]);
return $dataProvider;
}