| Conditions | 1 |
| Paths | 1 |
| Total Lines | 39 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function getConfigTreeBuilder(): TreeBuilder |
||
| 23 | { |
||
| 24 | $treeBuilder = new TreeBuilder(); |
||
| 25 | $rootNode = $treeBuilder->root('hmlb_ddd'); |
||
| 26 | |||
| 27 | $supportedDrivers = [ |
||
| 28 | 'orm', |
||
| 29 | 'mongodb', |
||
| 30 | ]; |
||
| 31 | |||
| 32 | $rootNode |
||
| 33 | ->children() |
||
| 34 | ->arrayNode('persistence') |
||
| 35 | ->addDefaultsIfNotSet() |
||
| 36 | ->children() |
||
| 37 | ->booleanNode('persist_commands')->defaultTrue()->end() |
||
| 38 | ->booleanNode('persist_events')->defaultTrue()->end() |
||
| 39 | ->scalarNode('command_repository_service') |
||
| 40 | ->defaultValue('hmlb_ddd.repository.command.default') |
||
| 41 | ->end() |
||
| 42 | ->scalarNode('event_repository_service') |
||
| 43 | ->defaultValue('hmlb_ddd.repository.event.default') |
||
| 44 | ->end() |
||
| 45 | ->end() |
||
| 46 | ->end() |
||
| 47 | ->scalarNode('db_driver') |
||
| 48 | ->defaultValue('orm') |
||
| 49 | ->validate() |
||
| 50 | ->ifNotInArray($supportedDrivers) |
||
| 51 | ->thenInvalid( |
||
| 52 | 'The driver %s is not supported. Please choose one of '.json_encode($supportedDrivers) |
||
| 53 | ) |
||
| 54 | ->end() |
||
| 55 | ->end() |
||
| 56 | |||
| 57 | ->end(); |
||
| 58 | |||
| 59 | return $treeBuilder; |
||
| 60 | } |
||
| 61 | } |
||
| 62 |