yiisoft / yiisoft/arrays

Add 'nest' method to ArrayHelper

Open
#6 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
PHP
Stars
56
Forks
29
Avg merge
1h 9m
Merged PRs (30d)
1

Description

I think we would be nice to introduce method 'nest' similar to CakePHP one to ArrayHelper. It is used to create threaded data (with children nodes).

More information regarding it:
https://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::nest
https://github.com/cakephp/utility/blob/master/Hash.php#L1172

Is it possible to get same response using ArrayHelper::map somehow ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked CakePHP Hash::nest implementation and comparing it with the existing ArrayHelper::map behavior. Confirm the desired threaded children-node response and determine whether map can provide it; done means ArrayHelper has a clearly defined nest operation or the issue is resolved with a documented alternative.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.