Custom action on controller


I’ve the User_lists models with two attribute ‘need_list’ and ‘spare_list’ (lists of trading card).

I’ve created a new action in my controller public function actionSwap($list_id) where I find the users to swap with, that is the users that have in spare_list the cards listed in current user need_list.

So I have as result a two-dimensional array with the common card to swap (comma separated card’s number) and the users (user_id) to swap with.



I would like to put this result in a gridview so in controller I would like to return $this->render(‘swap’, [… ]); but I can’t figured out the parameter to pass to this page.

Desidered swap page has a gridview with columns user_id ($results[0][‘user’],$results[1][‘user’]…), related common cards (e.g.$results[0][‘need’],$results[1][‘need’]…)

Thank you so much

Solved, Class yii\data\ArrayDataProvider make my day