Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple servers in configuration #191

Merged
merged 1 commit into from Nov 28, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 34 additions & 3 deletions DependencyInjection/Configuration.php
Expand Up @@ -45,10 +45,41 @@ private function addClientsSection(ArrayNodeDefinition $rootNode)
->useAttributeAsKey('id')
->prototype('array')
->performNoDeepMerging()
->beforeNormalization()
->ifTrue(function($v) { return isset($v['host']) && isset($v['port']); })
->then(function($v) {
return array(
'servers' => array(
'default' => array(
'host' => $v['host'],
'port' => $v['port'],
)
)
);
})
->end()
->beforeNormalization()
->ifTrue(function($v) { return isset($v['url']); })
->then(function($v) {
return array(
'servers' => array(
'default' => array(
'url' => $v['url'],
)
)
);
})
->end()
->children()
->scalarNode('url')->end()
->scalarNode('host')->end()
->scalarNode('port')->end()
->arrayNode('servers')
->prototype('array')
->children()
->scalarNode('url')->end()
->scalarNode('host')->end()
->scalarNode('port')->end()
->end()
->end()
->end()
->scalarNode('timeout')->end()
->scalarNode('headers')->end()
->end()
Expand Down