Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM_Utils_Array::pathMove - Add helper to move an item within array tree #20866

Merged
merged 1 commit into from
Jul 20, 2021

Conversation

totten
Copy link
Member

@totten totten commented Jul 16, 2021

Overview

Adds a helper function to move items within an array tree, e.g.

$foodStuffs = [
  'fruits' => [
    'apple' => ['sweet' => TRUE],
  ],
  'veggies' => [
    'tomato' => ['sweet' => FALSE],
  ],
];

// Ruhroh. Tomato had a culinary classification, but we need botanical classification!
CRM_Utils_Array::pathMove($foodStuffs, ['veggies','tomato'], ['fruits', 'tomato']);
// Assert: $foodStuffs['veggies']['tomato'] ==> undefined
// Assert: $foodStuffs['fruits']['tomato'] ==> ['sweet' => FALSE]

@civibot
Copy link

civibot bot commented Jul 16, 2021

(Standard links)

@civibot civibot bot added the master label Jul 16, 2021
@totten totten force-pushed the master-pathmove branch from 5ce80b2 to 884466e Compare July 16, 2021 04:47
@totten
Copy link
Member Author

totten commented Jul 20, 2021

jenkins, test this please

@seamuslee001
Copy link
Contributor

This seems fine to me merging

@seamuslee001 seamuslee001 merged commit 4401f07 into civicrm:master Jul 20, 2021
@totten totten deleted the master-pathmove branch July 21, 2021 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants