I want to parse a config of this structure:
$config = [
'streams' => [
'foo' => [
[
'id' => 'some-identifier',
'type' => 'a',
],
[
'id' => 'some-other-identifier',
'type' => 'b',
],
],
'bar' => ...,
],
];
In this array streams
is a predefined key and contains a map of multiple arbitrarily named streams. In this case there are two streams called foo
and bar
defined.
Every stream has an array of handlers. Every handler is a map with 2 attributes: id
and type
.
I ended up with:
$rootNode
->children()
->arrayNode('streams')
->prototype('array')
->children()
->end()
->end()
->end()
->end()
;
And now I'm in stuck on what would be next.
If I explain in English it would be: streams
is a map of arrays of maps.
And with my code I could express it up to "is a map" and in stuck how to say it's "of arrays".
Any hints?
That's how.
Note that the outer
prototype('array')
does not havechildren()