Error in Data Provider [solved ]

given below are my controller code n model code respectively i am getting an Fatal error i dont no y. can u plz help me identify the problem

public function actionTicketbookingreport()


{ 


	$model= new ScreenTicketBookingHistory();


	$searchModel = new ScreenticketbookinghistorySearch();


	$dataProvider = $searchModel->search(Yii::$app->request->queryParams);                .............................................................


}


public function search($params)


{


$user=AdminUsers::find()->where('id=:user',['user'=>Yii::$app->session->get('user_id')])->one();


    $query = ScreenTicketBookingHistory::find()->where('user_id =:id',[':id'=>$user->id])->all();


    $dataProvider = new ActiveDataProvider([


        'query' => $query,


    ]);  //print_r($dataProvider);die();  it has values


    $this->load($params);





    if (!$this->validate()) {


        // uncomment the following line if you do not want to any records when validation fails


        // $query->where('0=1');


        return $dataProvider;


    }





    $query->andFilterWhere([


        'id' => $this->id,


        'booking_date' => $this->booking_date,


        'show_date' => $this->show_date,


        'movie_id' => $this->movie_id,


        'theatre_id' => $this->theatre_id,


        'screen_id' => $this->screen_id,


        'show_time_id' => $this->show_time_id,


        'amount' => $this->amount,


        'user_id' => $this->user_id,


        'location_id' => $this->location_id,


        'created_by' => $this->created_by,


        'created_at' => $this->created_at,


        'updated_by' => $this->updated_by,


        'updated_at' => $this->updated_at,


        'is_deleted' => $this->is_deleted,


    ]);





    $query->andFilterWhere(['like', 'booking_id', $this->booking_id])


        ->andFilterWhere(['like', 'email', $this->email])


        ->andFilterWhere(['like', 'mobile', $this->mobile])


        ->andFilterWhere(['like', 'seat_info', $this->seat_info]);





    return $dataProvider;


}

i am getting a error as follows

Call to a member function andFilterWhere() on a non-object

when i printed the data provider it has values so why this errror…

thanks

you should skip ->all()

thanks for replying i tried the following code n it worked

public function search($params)

{


	$user=AdminUsers::find()->where('id=:user',['user'=>Yii::$app->session->get('user_id')])->one();


    $query = ScreenTicketBookingHistory::find();


    $dataProvider = new ActiveDataProvider([


        'query' => $query,


    ]);


    $this->load($params);





    if (!$this->validate()) {


        // uncomment the following line if you do not want to any records when validation fails


        // $query->where('0=1');


        return $dataProvider;


    }





    $query->andFilterWhere([


        'id' => $this->id,


        'booking_date' => $this->booking_date,


        'show_date' => $this->show_date,


        'movie_id' => $this->movie_id,


        'theatre_id' => $this->theatre_id,


        'screen_id' => $this->screen_id,


        'show_time_id' => $this->show_time_id,


        'amount' => $this->amount,


        'user_id' => $user->id,  // instead of specifing it in query i used it here


        'location_id' => $this->location_id,


        'created_by' => $this->created_by,


        'created_at' => $this->created_at,


        'updated_by' => $this->updated_by,


        'updated_at' => $this->updated_at,


        'is_deleted' => $this->is_deleted,


    ]);





    $query->andFilterWhere(['like', 'booking_id', $this->booking_id])


        ->andFilterWhere(['like', 'email', $this->email])


        ->andFilterWhere(['like', 'mobile', $this->mobile])


        ->andFilterWhere(['like', 'seat_info', $this->seat_info]);





    return $dataProvider;


}