You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #61718 [Config] Add argument $singular to NodeBuilder::arrayNode() to decouple plurals/singulars from XML (nicolas-grekas)
This PR was merged into the 7.4 branch.
Discussion
----------
[Config] Add argument `$singular` to `NodeBuilder::arrayNode()` to decouple plurals/singulars from XML
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues | -
| License | MIT
The capability of defining plural/singular variants for config node is used not only for XML but also for config builders generation.
The current method to deal with this concern is named `fixXmlConfig()`. It's confusing to say the least. What's also confusing is that the call needs to happen on the parent node.
This PR proposes to add a second argument to the `arrayNode()` method, so that things could be changed like this (example taken from the attached patch):
```diff
$rootNode
- ->fixXmlConfig('role', 'role_hierarchy')
->children()
- ->arrayNode('role_hierarchy')
+ ->arrayNode('role_hierarchy', 'role')
```
I'm not deprecating the `fixXmlConfig()` method - it would be way too early.
~In a follow up PR, I'll try to require setting this second argument (or calling fixXmlConfig) when a prototype is defined. If possible.~
Commits
-------
5ac6e748eb9 [Config] Add argument $singular to NodeBuilder::arrayNode() to decouple plurals/singulars from XML
0 commit comments