Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow multiple servers in configuration #191

Merged
merged 1 commit into from

3 participants

@odolbeau

With these additional configuration, it's possible to have a client which depends on more than only one server.

@richardmiller richardmiller merged commit 1bcc518 into FriendsOfSymfony:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 5, 2012
  1. @odolbeau
This page is out of date. Refresh to see the latest.
Showing with 34 additions and 3 deletions.
  1. +34 −3 DependencyInjection/Configuration.php
View
37 DependencyInjection/Configuration.php
@@ -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()
Something went wrong with that request. Please try again.