A
A
agent11562017-02-19 11:26:55
Yii
agent1156, 2017-02-19 11:26:55

What does this line and parameters search,queryParams mean?

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

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Snewer, 2017-02-19
@Snewer

The model has a method search
to which the request parameters are passed

Yii::$app->request->queryParams

As a result, the method returns the \yii\data\ActiveDataProvider object (for ActiveRecord)

M
Maxim Timofeev, 2017-02-19
@webinar

$dataProvider- variable
=- assignment operator
$searchModel- access to the object contained in the variable. Usually, based on the context, this is SomeMyModelSearch, which is inherited from SomeMyModel
->search- we turn to the search method in someMyModelSearch
Yii::$app->request->queryParams- the parameters that came to the controller
This code is usually generated by standard GII to filter data through gridView, for actionIndex

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question