Skip to content

Commit

Permalink
Merge pull request #10 from OpenClassrooms/improve_configuration
Browse files Browse the repository at this point in the history
improve configuration
  • Loading branch information
arnaud-23 committed Dec 8, 2016
2 parents 15c610d + d9dde66 commit e1f5893
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ public function getConfigTreeBuilder()
$rootNode->children()
->scalarNode('key')->isRequired()->end()
->scalarNode('token')->isRequired()->end()
->arrayNode('packs')
->useAttributeAsKey('pack')
->prototype('array')
->children()
->scalarNode('id')->isRequired()->end()
->scalarNode('name')->isRequired()->end()
->end()
->end()
->end()
->arrayNode('custom_field_ids')
->useAttributeAsKey('name')
->prototype('scalar')->end()
->end()
->end();

return $treeBuilder;
Expand Down
2 changes: 2 additions & 0 deletions DependencyInjection/OpenClassroomsFrontDeskExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public function load(array $config, ContainerBuilder $container)

$container->setParameter('openclassrooms.frontdesk.key', $config['key']);
$container->setParameter('openclassrooms.frontdesk.token', $config['token']);
$container->setParameter('openclassrooms.frontdesk.packs', $config['packs']);
$container->setParameter('openclassrooms.frontdesk.custom_field_ids', $config['custom_field_ids']);
}

/**
Expand Down
11 changes: 11 additions & 0 deletions Tests/DependencyInjection/Fixtures/Resources/Config/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
openclassrooms_frontdesk:
key: key
token: falsetoken
packs:
example_pack_identifier_1:
id: 365423
name: 'Example Pack 1'
example_pack_identifier_2:
id: 98764
name: 'Example Pack 2'
custom_field_ids:
example_name_1: 123454
"example name 2": 187435
exampleName3: 14536

0 comments on commit e1f5893

Please sign in to comment.