innerJoin("user_account_assignment",'product.id_account = user_account_assignment.id_account' ); $query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]); } $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; } if ( !empty($this->barcode)){ $this->barcode = strtolower($this->barcode); } if ( !empty($this->product_number)){ $this->product_number = strtolower($this->product_number); } $query->andFilterWhere([ 'product.id_product_category' => $this->id_product_category, 'product.id_account' => $this->id_account, 'product.status' => $this->status, 'lower(product.product_number)' => $this->product_number, 'lower(product.barcode)' => $this->barcode, ]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; } }