-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #14082 [config] Fix issue when key removed and left value only (z…
…erustech) This PR was submitted for the 2.3 branch but it was merged into the 2.7 branch instead (closes #14082). Discussion ---------- [config] Fix issue when key removed and left value only | Q | A | | --- | --- | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | #15270 | | License | MIT | | Doc PR | n/a | When a key attribute is mapped and the key is removed from the value array, if only 'value' element is left in the array, it should replace its wrapper array. Assume the original value array is as follows (key attribute is 'id'). ``` php array( 'things' => array( array('id' => 'option1', 'value' => 'value1'), array('id' => 'option2', 'value' => 'value2') ) ) ``` After normalized, the above shall be converted to the following array. ``` php array( 'things' => array( 'option1' => 'value1', 'option2' => 'value2' ) ) ``` It's also possible to mix 'value-only' and 'none-value-only' elements in the array: ``` php array( 'things' => array( array('id' => 'option1', 'value' => 'value1'), array('id' => 'option2', 'value' => 'value2', 'foo' => 'foo2') ) ) ``` The above shall be converted to the following array. ``` php array( 'things' => array( 'option1' => 'value1', 'option2' => array('value' => 'value2','foo' => 'foo2') ) ) ``` The 'value' element can also be array: ``` php array( 'things' => array( array( 'id' => 'option1', 'value' => array('foo'=>'foo1', 'bar' => 'bar1') ) ) ) ``` The above shall be converted to the following array. ``` php array( 'things' => array( 'option1' => array('foo' => 'foo1', 'bar' => 'bar1') ) ) ``` When using VariableNode for value element, it's also possible to mix different types of value elements: ``` php array( 'things' => array( array('id' => 'option1', 'value' => array('foo'=>'foo1', 'bar' => 'bar1')), array('id' => 'option2', 'value' => 'value2') ) ) ``` The above shall be converted to the following array. ``` php array( 'things' => array( 'option1' => array('foo'=>'foo1', 'bar' => 'bar1'), 'option2' => 'value2' ) ) ``` Commits ------- b587a72 [config] Fix issue when key removed and left value only
- Loading branch information
Showing
2 changed files
with
227 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters