extra query by ActiveDataProvider

I have a page using standard grid using ActiveDataProvider I need extract in controller the query of ActiveDataProvider. I need to create a new query from the filter results of ActiveDataProvider.

Ex:

$searchModel = new AcaoSearch();

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

//NEW QUERY

$newQuery = clone $dataProvider->query;

//I need something …

$newQuery->joinWith([‘xxxxx’]);// example - join with does not work in this example

$newQuery->asArray->all(); //example - as array does not work in this example

Why, what are you trying to achieve?

Next to the grid view will insert a panel with some values ​​. Within this panel , will have some values ​​where the result would be the sum of a column of the main model + column from a related model . These values ​​should follow the filter and may change if a filter is done in grid view