I'm using Config component on a standalone PHP app, and I would like to have in my configuration file a structure similar to below :
sites:
site1:
ftp:
server: myserver
name: name
...: ...
database:
server: myserver
name: ....
AFAIS, I need the useAttributeAsKey() method on my array for the "site1" node ("sites" node can handle several sites, with name as key).
I tried to set it up this way, but I end up to a "children method not in NodeDefinition". How to set it correctly?
$rootNode
->children()
->scalarNode(self::REMANENCE_NODE[self::NODE_NAME])
->defaultValue(self::REMANENCE_NODE[self::NODE_DEFAULT_VALUE])
->info('Contains the backup folders max value to keep on defined storages')
->end()
->arrayNode(self::SITES)
->requiresAtLeastOneElement()
->useAttributeAsKey('name')
->prototype('array')
->children()
->arrayNode(self::DATABASE)
->end()
->arrayNode(self::FILES)
->end()
->end()
->end()
Thanks for your replies, Nicolas