This repository has been archived by the owner. It is now read-only.

[Config] Set the file parameter optional #144

Merged
merged 1 commit into from May 12, 2012
Jump to file or symbol
Failed to load files and symbols.
+7 −3
Diff settings

Always

Just for now

@@ -39,7 +39,7 @@ public function getConfigTreeBuilder()
->children()
->scalarNode('app_id')->isRequired()->cannotBeEmpty()->end()
->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()
- ->scalarNode('file')->isRequired()->cannotBeEmpty()->end()
+ ->scalarNode('file')->defaultNull()->end()
->scalarNode('cookie')->defaultFalse()->end()
->scalarNode('domain')->defaultNull()->end()
->scalarNode('alias')->defaultNull()->end()
@@ -40,9 +40,14 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('fos_facebook.'.$attribute.'.class', $config['class'][$attribute]);
}
- foreach (array('file', 'app_id', 'secret', 'cookie', 'domain', 'logging', 'culture', 'permissions') as $attribute) {
+ foreach (array('app_id', 'secret', 'cookie', 'domain', 'logging', 'culture', 'permissions') as $attribute) {
$container->setParameter('fos_facebook.'.$attribute, $config[$attribute]);
}
+
+ if (isset($config['file']) && $container->hasDefinition('fos_facebook.api')) {
+ $facebookApi = $container->getDefinition('fos_facebook.api');
+ $facebookApi->setFile($config['file']);
+ }
}
/**
@@ -7,7 +7,6 @@
<services>
<service id="fos_facebook.api" class="%fos_facebook.api.class%">
- <file>%fos_facebook.file%</file>
<argument type="collection">
<argument key="appId">%fos_facebook.app_id%</argument>
<argument key="secret">%fos_facebook.secret%</argument>