db
db copied to clipboard
Add `ArrangeBy` option
Similar to IndexBy, this option will arrange records by a value.
For example
$userQuery = new ActiveQuery(User::class, $db);
$users = $userQuery->arrangeBy('status')->all();
The result is
[
'active' => [
0 => User,
1 => User,
2 => User,
],
'inactive' => [
0 => User,
1 => User,
],
];
It's also will be userfull in Query from Yii DB.