Add `ArrangeBy` option
Open
Nobody has claimed this yet.
type:enhancement
- Dominant language
- PHP
- Stars
- 216
- Forks
- 51
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 2
Description
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,
],
];
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the ActiveQuery entry point and its existing IndexBy behavior. Compare the requested ArrangeBy example with that behavior, then determine the project’s relevant query tests before implementing the grouping result. Done means arrangeBy('status')->all() returns records grouped by status as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100