How to display the model with grouping on one field?

There is a table "param"

| id | param_id | value |
| 1 | 50 | Name 1 |
| 2 | 50 | Name 2 |
| 3 | 50 | Name 3 |
| 4 | 555 | Name 4 |
| 5 | 555 | the Title 5 |
| 6 | 555 | Name 6 |

Team
Param::find()->asArray()->all();
displays
Array
(
 [0] => Array
(
 [id] => 1
 [param_id] => 50
 [value] => Name 1
)
 [1] => Array
(
 [id] => 2
 [param_id] => 50
 [value] => Name 2
)
 [2] => Array
(
 [id] => 3
 [param_id] => 50
 [value] => Name 3
)
 [3] => Array
(
 [id] => 4
 [param_id] => 555
 [value] => Name 4
)
 [4] => Array
(
 [id] => 5
 [param_id] => 555
 [value] => Name 5
)
 [5] => Array
(
 [id] => 6
 [param_id] => 555
 [value] => Name 6
)
)

How do I group the array by the field "param_id"? To output to array
Array
(
 [55] => Array
(
 [0] => Array
(
 [id] => 1
 [param_id] => 50
 [value] => Name 1
)
 [1] => Array
(
 [id] => 2
 [param_id] => 50
 [value] => Name 2
)
 [2] => Array
(
 [id] => 3
 [param_id] => 50
 [value] => Name 3
)

)

 [555] => Array
(
 [0] => Array
(
 [id] => 4
 [param_id] => 555
 [value] => Name 4
)
 [1] => Array
(
 [id] => 5
 [param_id] => 555
 [value] => Name 5
)
 [2] => Array
(
 [id] => 6
 [param_id] => 555
 [value] => Name 6
)
 ) 
)

Tried
Param::find()->groupBy('param_id')->asArray()->all();

not working...

It is certainly possible using foreach, but is there another way?
June 5th 19 at 20:59
1 answer
June 5th 19 at 21:01
https://www.yiiframework.com/doc/guide/2.0/en/help...

$result = ArrayHelper::index($array, null, 'param_id');

Find more questions by tags Yii