Yii2 - GridView - How Sorting works?

I am trying to understand how sorting works in GridView by means of generating a default CRUD application. Sorting happens after clicking the respective attribute which is the table header. The column name is attached to the url with the variable sort and on click the action method is invoked, but what I am wondering is that the action method which is mentioned in the url with the actual variable $sort is not present in the controller.

Below is a example

The url looks like the below,

/advanced/frontend/web/index.php?r=site%2Findex&sort=customer_user_name2

But there is no corresponding action method in the site controller as function actionIndex($sort);

‘sort’ is a $_GET param retrieved in actionIndex method by the line:


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

Then feed into ‘YourModelSearch’ model.