What I'm doing wrong.

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; } 
  • 2
    In Russian stackoverflow it is customary to ask questions in Russian, please translate. - Sergey Glazirin
  • one
    it is written, an unknown column, what is there to be unclear then? - teran
  • This is understandable, but I’m baking. I’m doing a JOIN on the CultureGrowStage. - Yaroslav Yaroslav

0