public function addRepositoriesSection(ArrayNodeDefinition $rootNode)
{
$rootNode->children()->arrayNode('repositories')->info('Content repositories configuration')->example(array('main' => array('storage' => array('engine' => 'legacy', 'connection' => 'my_doctrine_connection_name'))))->useAttributeAsKey('alias')->prototype('array')->beforeNormalization()->always(function ($v) {
if (isset($v['storage'])) {
return $v;
}
if (isset($v['engine'])) {
$v['storage']['engine'] = $v['engine'];
unset($v['engine']);
}
if (isset($v['connection'])) {
$v['storage']['connection'] = $v['connection'];
unset($v['connection']);
}
if (isset($v['config'])) {
$v['storage']['config'] = $v['config'];
unset($v['config']);
}
return $v;
})->end()->beforeNormalization()->always(function ($v) {
if ($v === null) {
$v = array();
}
if (!isset($v['storage'])) {
$v['storage'] = array();
}
if (!isset($v['search'])) {
$v['search'] = array();
}
if (!isset($v['fields_groups']['list'])) {
$v['fields_groups']['list'] = ['content'];
}
if (!isset($v['fields_groups']['default'])) {
$v['fields_groups']['default'] = 'content';
}
return $v;
})->end()->children()->arrayNode('storage')->children()->scalarNode('engine')->defaultValue('%ezpublish.api.storage_engine.default%')->info('The storage engine to use')->end()->scalarNode('connection')->defaultNull()->info('The connection name, if applicable (e.g. Doctrine connection name). If not set, the default connection will be used.')->end()->arrayNode('config')->info('Arbitrary configuration options, supported by your storage engine')->useAttributeAsKey('key')->prototype('variable')->end()->end()->end()->end()->arrayNode('search')->children()->scalarNode('engine')->defaultValue('%ezpublish.api.search_engine.default%')->info('The search engine to use')->end()->scalarNode('connection')->defaultNull()->info('The connection name, if applicable (e.g. Doctrine connection name). If not set, the default connection will be used.')->end()->arrayNode('config')->info('Arbitrary configuration options, supported by your search engine')->useAttributeAsKey('key')->prototype('variable')->end()->end()->end()->end()->arrayNode('fields_groups')->info('Definitions of fields groups.')->children()->arrayNode('list')->prototype('scalar')->end()->end()->scalarNode('default')->defaultValue('content')->end()->end()->end()->end()->end()->end()->end();
}