configs: overwrite via prepend, mode instead of duration_only (#715)
This commit is contained in:
@@ -32,6 +32,14 @@ class AppExtension extends Extension
|
||||
$config = [];
|
||||
}
|
||||
|
||||
// @deprecated since 0.9, duration_only will be removed with 1.0
|
||||
if (isset($config['timesheet']['duration_only'])) {
|
||||
trigger_error('Configuration "kimai.timesheet.duration_only" is deprecated, please remove it', E_USER_DEPRECATED);
|
||||
if (true === $config['timesheet']['duration_only'] && 'duration_only' !== $config['timesheet']['mode']) {
|
||||
trigger_error('Found ambiguous configuration. Please remove "kimai.timesheet.duration_only" and set "kimai.timesheet.mode" instead.');
|
||||
}
|
||||
}
|
||||
|
||||
// safe alternatives to %kernel.project_dir%
|
||||
$container->setParameter('kimai.data_dir', $config['data_dir']);
|
||||
$container->setParameter('kimai.plugin_dir', $config['plugin_dir']);
|
||||
|
||||
@@ -75,6 +75,16 @@ class Configuration implements ConfigurationInterface
|
||||
->children()
|
||||
->booleanNode('duration_only')
|
||||
->defaultValue(false)
|
||||
->setDeprecated()
|
||||
->end()
|
||||
->scalarNode('mode')
|
||||
->defaultValue('default')
|
||||
->validate()
|
||||
->ifTrue(function ($value) {
|
||||
return !in_array($value, ['default', 'duration_only']);
|
||||
})
|
||||
->thenInvalid('Chosen timesheet mode is invalid, allowed values: default, duration_only')
|
||||
->end()
|
||||
->end()
|
||||
->booleanNode('markdown_content')
|
||||
->defaultValue(false)
|
||||
|
||||
Reference in New Issue
Block a user